NexusFi: Find Your Edge


Home Menu

 





Q on signal counting in MC


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one Jura with 3 posts (3 thanks)
    2. looks_two aczk with 3 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 Nicolas11 with 1 posts (1 thanks)
    1. trending_up 3,216 views
    2. thumb_up 4 thanks given
    3. group 0 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread

Q on signal counting in MC

(login for full post details)
  #1 (permalink)
 aczk 
London, UK
 
Experience: Intermediate
Platform: MultiCharts
Trading: equities, futures
Posts: 36 since Jan 2012
Thanks Given: 3
Thanks Received: 2

Hi guys

How do I count signals, like a crossover on an indicator, while also filtering out the ones I do and do not want count be bar distances.

Like MA cross, count 1, then if it crosses again within 20 bars don't count it, count if above and set as condition for the next part??? Just to get rid of jittery indicator action...

Thx & appreciate any help

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Looking for an MQL4 MetaTrader programmer/coder
The Elite Circle
Request for MACD with option to use different MAs for fa …
NinjaTrader
Futures Close-Out Policy
Commodities
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Daytrading ES & NQ
32 thanks
Battlestations: Show us your trading desks!
30 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Retail Trading As An Industry
25 thanks

(login for full post details)
  #3 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690



aczk View Post
How do I count signals, like a crossover on an indicator, while also filtering out the ones I do and do not want count be bar distances.

Like MA cross, count 1, then if it crosses again within 20 bars don't count it, count if above and set as condition for the next part?

Can you elaborate somewhat on your question? Perhaps show your code so far?

I don't think I follow you completely - when do you want to count it, and exactly when doesn't it count? And: "count if above and set as condition for the next part" - count what (crossovers, bars)? Which condition (cross over condition, bar count < 20 condition)? And which "part"?

I don't get it.

Reply With Quote
(login for full post details)
  #4 (permalink)
 aczk 
London, UK
 
Experience: Intermediate
Platform: MultiCharts
Trading: equities, futures
Posts: 36 since Jan 2012
Thanks Given: 3
Thanks Received: 2

Hi thx for taking a look...


For example:
1 Price crosses above the MA, I want MC to count one signal.
2 Price crosses below MA and above again within, say within 30 bars. I don't want MC to count this, too close.
3 Price crosses above MA a third time after 50 bars, which I want to count.
4 Count should be 2 now.
5 Now Stochastic cross above 50 and count = 2, I want to go Long.

So how to count signals and filter counts by bar distances in-between them.

Thx

Started this thread Reply With Quote
(login for full post details)
  #5 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


aczk View Post
For example:
1 Price crosses above the MA, I want MC to count one signal.
2 Price crosses below MA and above again within, say within 30 bars. I don't want MC to count this, too close.
3 Price crosses above MA a third time after 50 bars, which I want to count.
4 Count should be 2 now.
5 Now Stochastic cross above 50 and count = 2, I want to go Long.

Ah I see.

Something like the following should get you started:
 
Code
Variables:
    countedSignals(0), barNumberOfSignal(0), maQuick(0), maSlow(0), stochD(0), stochK(0);
    
maQuick = XAverage(Close, 5);
maSlow     = XAverage(Close, 20);
value20 = Stochastic(High, Low, Close, 12, 3, 3, 1, value99, value98, stochK, stochD);

if (maQuick crosses above maSlow) then begin

    // 1. Price crosses above the MA, I want MC to count one signal.
    if (countedSignals = 0) then begin
        countedSignals = 1;
    
        barNumberOfSignal = CurrentBar;
    end;    
    
    // 2. Price crosses below MA and above again within, say within 30 bars. I don't want MC to count this, too close.
    // 3. Price crosses above MA a third time after 50 bars, which I want to count.
    // So, there have to be at least 50 bars since the first cross over
    if ((CurrentBar - barNumberOfSignal) > 50) then
        countedSignals = countedSignals + 1;

end;

// 4. Count should be 2 now.
// 5. Now Stochastic cross above 50 and count = 2, I want to go Long.
if (countedSignals = 2) and (stochK crosses above 50) then
    Buy ("EL#1") 1 contracts next bar at market;
    
// Reset 'countedSignals' to 0 after a closed position, so
//    the code can start looking for the next trade
if (BarsSinceExit(1) < 3) then
    countedSignals = 0;
See the comments in the code above for explanation and your comments translated to MC.

Good luck!

Reply With Quote
The following 3 users say Thank You to Jura for this post:
(login for full post details)
  #6 (permalink)
 aczk 
London, UK
 
Experience: Intermediate
Platform: MultiCharts
Trading: equities, futures
Posts: 36 since Jan 2012
Thanks Given: 3
Thanks Received: 2

Hi thx for taking the time for the code...
somewhat cant get it to work though.

I dojt want two MAs two cross, but just filter several consecutive price over MA crosses. Don't count the ones two close together, e.g. two quick whipsaws. Then go long after the third cross if another indicator crosses a certain spot/value.

Thanks for any advice on this

Started this thread Reply With Quote
(login for full post details)
  #7 (permalink)
 
Nicolas11's Avatar
 Nicolas11 
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
Posts: 1,071 since Aug 2011
Thanks Given: 2,232
Thanks Received: 1,769

Hi aczk,

One of the best MultiCharts programmer of this forum took time to code exactly what you specified, and your answer is the one above.

Apparently, the answer does not satisfy you. But I personally have understood your question the same as Jura did.

If you want a solution to your problem, you will probably find it on futures.io (formerly BMT). But, please, explain clearly what you want. And "clearly" means "not as in messages #1 and #6".

Nicolas

Visit my NexusFi Trade Journal Reply With Quote
The following user says Thank You to Nicolas11 for this post:





Last Updated on February 14, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts