Heikin Ashi candlestick body and moving average condition
Forums › ProRealTime English forum › ProOrder support › Heikin Ashi candlestick body and moving average condition
- This topic has 23 replies, 3 voices, and was last updated 6 years ago by Nicolas.
Tagged: heikin ashi
-
-
09/20/2018 at 8:30 PM #8099109/20/2018 at 11:24 PM #80996
For information here’s what my code looks like:
123456789101112131415161718192021222324252627DEFPARAM CumulateOrders = false// Annule tous les ordres en attente et ferme toutes les positions à 0:00, puis empêche toute création d'ordre avant l'heure "FLATBEFORE".DEFPARAM FLATBEFORE = 080000// Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"DEFPARAM FLATAFTER = 173000//Heikin-AshixClose = (Open+High+Low+Close)/4if(barindex>2) thenxOpen = (xOpen[1] + xClose[1])/2endifGreen = xClose>xOpenPeriod=30 // 48 34inner = 2*weightedaverage[ round( Period/2 ) ](xclose)-weightedaverage[Period](xclose)MMHULL=weightedaverage[ round( sqrt(Period) ) ]( inner )macross = xclose crosses over MMHULLif green[1] and macross and green thenbuy at marketendifset target pprofit 7// EN 1 MIN 9 7set stop ploss 31 // EN 1 MIN 11 31What I don’t get is the clos and why it keeps opening position 1 bar “too late”, is there a way to make it one bar before for the entry?
09/21/2018 at 9:25 AM #8100009/21/2018 at 9:26 AM #8100109/21/2018 at 10:02 AM #8100209/21/2018 at 10:15 AM #8101009/21/2018 at 10:16 AM #8101109/21/2018 at 10:31 AM #8101212Green = xClose>xOpenharange = abs(xclose-xopen)“Green” is a condition showing when the current candle is above the previous candle
“harange” is calculating the abs value of an evolution
So when you write:
1harange>harange[1]It returns “Green” but on previous candles right?
09/21/2018 at 11:58 AM #81015I get it but why calculate xClose and not xOpen then?
To be calculated xOpen need at least 1 xClose, that’s why we wait 2 barindex before its calculation:
123if(barindex>2) thenxOpen = (xOpen[1] + xClose[1])/2endif“Green” is a condition showing when the current candle is above the previous candle
No. Green is a boolean condition to test if xClose is superior to xOpen (a green Heikin Ashi candle), if it is true, green=1.
I strongly recommend you to watch the training videos for programming, the first course is free 😉
harange>harange[1] is testing if the current range is superior to its previous one, like the way you want in your initial request. Number in brackets is an offset in the past.
-
AuthorPosts
Find exclusive trading pro-tools on