Loop misfunction
-
Hey, im trying to make a looping structure, but i dont manage to make it work.
What i want is the EA to : - Check the last candles until the 5th one
- Calculate the average wick size for, the cld0(actual one), for the cdl0+1(actual and previous one) , for the cdl0+1+2 ... cdl 0+1+2+3+4+5
- Go out the loop as soon as this average is above 5 pips
- And open sell(short)Here is what i made : https://fxdreema.com/shared/T4oNVqQPb
Note : the journal tells me that the EA checks for 128mb of data then stop. So the loop isn't stopping i suppose.
-
Actually i think the way the "÷" works(block 7) , is not : X ÷ Y = X/Y
but = Y/X
Cause X divides Y. -
Since you work with Candle ID 0 (the actual one), you won't be able to do a visual test just that easily, because the triger will be different from the closed value. Anyway, here is one (of many possible) testing purposes which can help you visualize what's going on.
https://fxdreema.com/shared/Ajn5MAV5c
I used a different way to loop than you (you still be able to achieve the goal with your loop).
Have a fun with the Candle ID 0



-
note, the Average Wick (the Red value) is printed as soon as the value is triggered (the closing values may still change, but the Red will be printed and not changed accordingly)
you may rewrite the logic to do the change ... -
@miro1360
What is really good is that, there are always many ways to do one thing on FxD.
Still got trouble from this candle 0(a mistake i did before), i should have noticed that, moreover i think that in this strategy, taking in count the wick size of the current candle before it finishes to form, doesn't really make sense.
But i've analyzed your construction(took me a bit of time), and i totally got it : ). Except the text code part in draw blocks, i know nothing about coding.
Im gona use it in in my strategy(not finalized) and tell you if something blocks me, but it should be ok.Thanks a lot for taking that time tho!
-

The function is very very simple. It converts double value to Text (string) format with defined decimals (avgWick is the value, nr 1 is thought to be one tenth). Question is why I used it here in the Draw block? Because it is one of ways how to get rid of weird decimals printed on the chart. Text (code input) selection must be selected, otherwise it doesn't work.
You can use another functions too (it didn't work here because of the wrong selection, Text (code input) instead of Numeric)
https://fxdreema.com/forum/topic/8067/trading-tool-with-weird-info-box/5 -
Hey back, so as i said i re adapted your model to exclude the upWick of candle 0.
I did these change on the project (first picture) :

I had to put the "math ID" adjustment before the wick calculation, so it starts with the cdl 1.There is what it looks like know (second picture) :
