SteepCurve: Can anybody suggest why the following function would randomly delete TakeProfit levels when modifying the TrailingStop. if(orderModifyReliable(maSLTPticket,OrderOpenPrice(),maNewSLf,OrderTakeProfit(),0,Cyan)) | Maybe because you are using OrderTakeProfit() without doing an OrderSelect() first. |
Thanks for the reply.
This function was also an a venture into the world of arrays. This is the first time I have used them and maybe I've made some poor assumptions on what they can/can not do.
Both the MAslAr and CtAr arrays should only contain one order at any one time. Both arrays store the information for the trade open in the strategy they represent.
The reason there is no OrderSelect function is because the function first checks if there is an order open for that strategy...
if(MAslopeCnt>=1){ and if(CtCnt>=1){
and then calls the arrays mentioned above to set a number of local variables which store information about the trade, including OrderTicketNumber().
Am I wrong in thinking that calling/storing the ticket number in this way does not replicate the OrderSelect() function?
SteepCurve: Am I wrong in thinking that calling/storing the ticket number in this way does not replicate the OrderSelect() function?
| You're not passing what is in your array to OrderModify, you are passing OrderTakeProfit() which has no value because you didn't select the order first. What is in your arrays is irrelevant to OTP. Either use what is in your arrays ONLY, or select the order by ticket so you can use OTP. |
"You're not passing what is in your array to OrderModify, you are passing OrderTakeProfit() which has no value because you didn't select the order first. What is in your arrays is irrelevant to OTP."
So even if the orderticket number is stored (in this case in) Array[1][1] and this value is stored in a variable like this
maSLTPticket=MAslAr_New[1][1];
, then calling maSLTPticket in OrderModify() will not select the correct order to act upon? OrderStopLoss is in Arary[1][7] and OrderTakeProfit is in Array[1][8]. Can arrays not be used for this type of operation?
If not, what can order arrays be used for (other than counting orders)?
"Either use what is in your arrays ONLY, ...."
I am a little confused by this. I am not trying to use anything that isn't stored in my array (at least I don't think I am).
if(orderModifyReliable(maSLTPticket,OrderOpenPrice(),maNewSLf,OrderTakeProfit(),0,Cyan))
I finally understand the meaning of RFTM. And make sure its read properly too. not just looked at and have the information go in one eye ball and out the other.
Sorry for the hassle. What you have been saying is blatantly obvious now.
An OrderSelect loop on the respective arrays has solved this issue.
Thank you for your patience.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Can anybody suggest why the following function would randomly delete TakeProfit levels when modifying the TrailingStop.
TakeProfit, TrailingStop and TrailingStep are all controlled by this function. This function also controls these levels for two different strategies running within the EA. Both strategies have thier own block within this function and each block is then divided into a sub-block which sets the Initial StopLoss/TakeProfit, and another which adjusts the StopLoss (TrailingStop).
The problem: this function can sucessfully handle these roles for each strategy independantly. When both strategies are activated, then the TakeProfit is 'randomly' deleted in the process of setting the TrailingStop
Chhers