Hi all,
I've been trying to teach myself mql4 and to that end I have made a custom indicator.
I'm now trying to make that into an EA but I am struggling with the syntax.
I currently have:
What I would like to do is close 70% of the lots and move the SL to breakeven when another set of criteria are met, and then close the final 30% at a final set of criteria.
I have variables 'lots70' and 'lots30' which already calculate those appropriate number of lots but I don't know how to reliably achieve this partial close. I'm imagining that I need to create some sort of flag to indicate that a trade is live in a particular direction and then create another 'if' statement for the partial close. However, I'm really not sure of the syntax for this.
The other problem I have is that the variables change as time progresses but I would like to use the values of the variables at the time of order. Are buffers the only way to achieve this?
Many thanks in advance for any help that may be offered.
(my apologies for how rudimentary this is, but I am still very much learning!)
I've been trying to teach myself mql4 and to that end I have made a custom indicator.
I'm now trying to make that into an EA but I am struggling with the syntax.
I currently have:
Inserted Code
if(OrdersTotal() == 0) { if(Ask==HighLineValue && cci>=90) { OrderSend(Symbol(), OP_BUY, lots, Ask, slippage, LowLineValue, HalfHigh, 0); } if(Bid==LowLineValue && cci<=-90) { OrderSend(Symbol(), OP_SELL, lots, Bid, slippage, HighLineValue, HalfLow, 0); } }
I have variables 'lots70' and 'lots30' which already calculate those appropriate number of lots but I don't know how to reliably achieve this partial close. I'm imagining that I need to create some sort of flag to indicate that a trade is live in a particular direction and then create another 'if' statement for the partial close. However, I'm really not sure of the syntax for this.
The other problem I have is that the variables change as time progresses but I would like to use the values of the variables at the time of order. Are buffers the only way to achieve this?
Many thanks in advance for any help that may be offered.
(my apologies for how rudimentary this is, but I am still very much learning!)