Variables issue
-
Evening, i'm posting a new topic cause im having somme issues with the variables fonctionnement.
Basically im trying to give as a value to my first variable, the level of the current closing candle, and, to my second, the level of the opening 3rd previous one, to fix TP and SL, in fonction of them, half over and half below the current candle. However its continues to set very narrow TP and SL. Here is my project so you can see
link text -
@seb-0 Tried to understand what you're doing, but I need some debug statements for this. However, you run the code every 100 minutes, is that what you want to do. I have no idea how fxdreema reacts when at this time candle in not closed, yet .. which price it takes. Maybe better to do once per bar and specify the number of bars that would equal your 100 minutes on the desired timeframe?!?
Further keep an eye on the block numbers as fxdreema run the start blocks or single blocks from lowest to highest number. In your case that means that your variable calculations happen after your buy condition check. If you don't restet the variable the results may be unpredictably.

See the screenshot. Here I reset Var1 each time the white dot is called.
So try to fix that first and then we can see if it calculates the desired results.
-
Don't know what you want by debug statements, if you need the source code.. But i've followed your advices to re-edit my project in a simpler way, with "n" bars filter, blocks name in right order, and resetting the value of the variable before the formula, still doesn't open trades. You can see it there :https://fxdreema.com/shared/9GFvcA8xc
-
@seb-0 Do you see some errors in expert or journal log?
If you work with once per bar, the line is executed on first tick of the bar. If you specify your calculations on candle ID0, It's unlikely that it will have a 3 pip candlesize already.

So better do your calculations on previous candle with ID1!
-
Indeed, i changed my Candles ID from 0 to 2, and added a new condition with a candle ID 1, now im at the same point than earlier : very narrow SL and TP as the journal says,

https://fxdreema.com/shared/u07I7FQgc -
@seb-0 Yeah, some brokers have a huge stop level. If calculations are right, what I assume, I'd say change the broker or the timeframe to get bigger candles!?!