Set Order Level as Variable
-

Hoping that somebody will help me with this one please.I want to be able to use the calculated buy level as shown(reverse for sell)
I know how to identify the candle that determines the buy level but cannot think how to use the obtained price level in the buy condition block. -
Can you please share your project? It shouldn''t be difficult if your EA already identifies the correct buy candle.
-
https://fxdreema.com/shared/XItjXbqtd
this may help get you started. It just doesn't include a way to figure out (not greater than 10 candles) for the (proposed buy candle).
open up the blocks and check what I made. test it out and modify according to your requirements.
-
@q8carpenter Really appreciate your input - drawing a line as a chart object and then deleting it is probably the key to my strategy. Somehow need to ID the candle where the conditions are met so I can work out 10 candles from there.
I am using mt5 and not mt4 so hopefully can still do what you said -
@kriordan
I actually made a mistake on the first block. here's a screenshot for the fix. and yes you can do the same for MT5 just don't copy and paste the project cuz I remember that wasn't something that used to work before.
-
@l-andorrà thanks for your response.
I can identify the buy price as per the attached project. I dont want to buy at this candle however until it is confirmed that the price will reverse and cross back above the low of this candle. This will also need to happen within 10 candle(set as a constant) or the trade will not proceed. https://fxdreema.com/shared/DFKpPnebb -
Some operands of you condition blocks are working on candle ID 0 whereas other doing it on dandle ID 1. Please check tehm all to candle ID 1.
-
@l-andorrà thanks - any thoughts about my question?
-
Well, your requirements are not trivial. You are asking for a reversal first and then a new impulse and all of that within a specific period of candles. That is a project in itself in which several additional variables will be required. You will need a very detailed set of conditions to identify those requirements. For example, can price move up and down limitless below the buy level before crossing up? If not, which are the limits?
-
@l-andorrà Not concerned about price movement below the buy line. I found this post on the Forum
https://fxdreema.com/forum/topic/7048/can-i-add-save-any-number-in-memory-ea/8It would appear that if I could save the ID of the candle where the buy/sell price was set then I could refer to that candle to get the buy/sell price and use expiry on the buy/sell block to ensure that the transaction occurred within 10 candles of the ID candle.
Do you think that the above Memory variable might be the answer? - it would need to self delete after the order was complete or expired. -
More or less. If you just need that, everything should be easier. You can create a counter. Just create a variable and initialize as a 0. Once you identify the candle then give it a value of 1.
Then every new candle after that will add +1 to the value and finally you can use a condition block comparing the value of the variable to the maximum value possible (with another variable or constant, as you prefer. Does it make sense for you?
-
@l-andorrà I think so but wont know till I try - thank you for your persistence and I will let you know how I go
-
Good. Don't hesitate to be back if you need it.