DAX EMA Cross-over decimal level
Forums › ProRealTime English forum › ProOrder support › DAX EMA Cross-over decimal level
- This topic has 7 replies, 5 voices, and was last updated 7 years ago by
robertogozzi.
-
-
12/08/2017 at 11:00 AM #55047
Hi Nicolas
I am interested in trend-following the DAX on IG using PRC using a 5 minute timeframe using couple moving averages.
My main issue is that on PRT it goes to 5 decimal places when a MA value is displayed. Hence a cross-over is activated even if one MA value is just say 0.1
For example on the DAX you often get, what I call a ‘touch/kiss’ of moving averages, so technically a cross-over has occurred, but at a level in my opinion, of <0.5 is irrelevant: I would not want to exit this trade, I would want to stay in, till the next 5 minute candle has finished. That candle may indeed confirm that I do have to exit that trade and open a new trade but also often, the trade carries on in the same direction. The result here is that we do not have to exit and then re-enter the trade, which can cost us quite a bit sometimes. I need the code to reflect this difference of at least 0.5 before we exit that trade and re-enter a new one. I have actually attached a picture of a DAX screenshot (red arrow) of a typical MA ‘touch/kiss’ on November 14th, these happen at least 3 times per week on a 5 min chart. The majority of these are ‘false’ cross-overs i.e. the trade is still going in your desired direction, but the PRC would activate and you’d have to exit and then re-enter, so costing you points.
I really do hope you can help !
OSCARDAX / UK
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263// --- settingsamount = 1 //amount of lots/shares/contracts for each orderfastEMAperiod = 5 //fast EMA periodslowEMAperiod = 20 // slow EMA periodstarthour = 070000 //start hour for trading (hhmmss format)endhour = 210000 //end hour for trading (hhmmss format)preOpenMaxDistance = 35 //previous starthour distance in points to initiate the 'starthour' trade or notovernight = 1 //keep overnight orders or close them at "endhour" (1=true / 0=false)// --- end of settings//indicatorsfast = exponentialaverage[fastEMAperiod](close)slow = exponentialaverage[slowEMAperiod](close)//trading conditionsbull = fast crosses over slowbear = fast crosses under slow//distance from last crossif bull thenlastcross=1crossprice=closemaxdistance=0endifif bear thenlastcross=-1crossprice=closemaxdistance=0endifif lastcross=1 thenmaxdistance=max(high-crossprice,maxdistance)endifif lastcross=-1 thenmaxdistance=max(crossprice-low,maxdistance)endif//starthour tradeif time=starthour and maxdistance<preOpenMaxDistance*pointsize thenif lastcross=1 and not longonmarket thenbuy amount contract at marketendifif lastcross=-1 and not shortonmarket thensellshort amount contract at marketendifendif//next ordersif time>starthour and time<endhour thenif bull thenbuy amount contract at marketendifif bear thensellshort amount contract at marketendifendif//overnight orders or not?if onmarket and overnight=0 and time>=endhour thensell at marketexitshort at marketendif//graph maxdistance12/08/2017 at 1:03 PM #5510212/08/2017 at 9:49 PM #5520112/08/2017 at 10:03 PM #5520312/09/2017 at 3:53 PM #55224When the croosing happens you can decide to ignore it, till the next event, if the difference between the two MAs is less than “n” pips!
Roberto
12/09/2017 at 7:20 PM #55230Hi Roberto,
Thanks for your comment, but I want the rule to be based upon the difference between the moving averages themselves and not the actual price / pips. The reason I say this is that often you will get a price ‘spurt’ up or down within a certain timeframe but that is strictly that, a temporary phenomenon, the price then carries on doing what it was doing. I think the worse thing is that you exit because of say ‘n pips crossover’ and guess what….the actual MA itself – because its an average – stays in the same position. You have now exited the trade because of a price jump, but the MA is still in the same direction ! the psychological impact on you as a MACO trader will not be good, you’ll be kicking yourself. IMHO me personally, I have to stick to the core principle and that’s the average price and not the actual.
As always in trading we need to think of our mindsets and not just the outcome itself….
OSCARDAX
12/12/2017 at 11:44 AM #55472Please try with this modified code and give feedbacks here:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869// --- settingsamount = 1 //amount of lots/shares/contracts for each orderfastEMAperiod = 5 //fast EMA periodslowEMAperiod = 20 // slow EMA periodstarthour = 070000 //start hour for trading (hhmmss format)endhour = 210000 //end hour for trading (hhmmss format)preOpenMaxDistance = 35 //previous starthour distance in points to initiate the 'starthour' trade or notovernight = 1 //keep overnight orders or close them at "endhour" (1=true / 0=false)// --- end of settings//indicatorsfast = exponentialaverage[fastEMAperiod](close)slow = exponentialaverage[slowEMAperiod](close)//trading conditionsbull = fast crosses over slowbear = fast crosses under slow//orders exit managementif longonmarket and bear and slow-fast>0.5*pointsize thensell at marketendifif shortonmarket and bull and fast-slow>0.5*pointsize thenexitshort at marketendif//distance from last crossif bull thenlastcross=1crossprice=closemaxdistance=0endifif bear thenlastcross=-1crossprice=closemaxdistance=0endifif lastcross=1 thenmaxdistance=max(high-crossprice,maxdistance)endifif lastcross=-1 thenmaxdistance=max(crossprice-low,maxdistance)endif//starthour tradeif time=starthour and maxdistance<preOpenMaxDistance*pointsize thenif lastcross=1 and not onmarket thenbuy amount contract at marketendifif lastcross=-1 and not onmarket thensellshort amount contract at marketendifendif//next ordersif time>starthour and time<endhour and not onmarket thenif bull thenbuy amount contract at marketendifif bear thensellshort amount contract at marketendifendif//overnight orders or not?if onmarket and overnight=0 and time>=endhour thensell at marketexitshort at marketendifBefore entering a new trade, the code checks if we are actually on market or not. At the beginning of the code, orders are closed accordingly to the 0.5 points MA differences if a new MA cross over/under has occurred.
12/12/2017 at 12:33 PM #55488Hi Roberto, Thanks for your comment, but I want the rule to be based upon the difference between the moving averages themselves and not the actual price / pips. The reason I say this is that often you will get a price ‘spurt’ up or down within a certain timeframe but that is strictly that, a temporary phenomenon, the price then carries on doing what it was doing. I think the worse thing is that you exit because of say ‘n pips crossover’ and guess what….the actual MA itself – because its an average – stays in the same position. You have now exited the trade because of a price jump, but the MA is still in the same direction ! the psychological impact on you as a MACO trader will not be good, you’ll be kicking yourself. IMHO me personally, I have to stick to the core principle and that’s the average price and not the actual. As always in trading we need to think of our mindsets and not just the outcome itself…. OSCARDAX
Moving averages by themselves DON’T exist. They always represent price. If, at the closing of a bar, average[10] is 12300 and average[20] is 12295 the difference can only be measured using price or pips (they are the same thing, only expressed in different ways).
-
AuthorPosts
Find exclusive trading pro-tools on