One way would be to OrderSelect the order, then subtract the OrderOpenPrice from the OrderStopLoss
MathAbs might be useful to.
void start()//void MinimumProfit() { double resOS; if (OrdersTotal()>0) resOS=OrderSelect(0,SELECT_BY_POS,MODE_BASE); int A=OrderOpenPrice(); int B=OrderStopLoss(); int C=MP(A,B); } int MP(int val1,int val2); { MSL=(val1-val2); return(MSL); }
thats what i have now but i have errors. i would like to see samples to learn. reference only shows a little to understand. please point me in the right way to see some
MathAbs code. I guess im wrong with this function
Thanks
thats what i have now but i have errors. i would like to see samples to learn. reference only shows a little to understand. please point me in the right way to see some
MathAbs code. I guess im wrong with this function
Thanks
1) I would strongly suggest to use brackets {..}!!
2) What do you expect to happen if OrdersTotal()==0 and/or resOS == false?
3) Have a little look in your Mt4-reference search for MathAbs..
void start()//void MinimumProfit() { bool resOS; double A,B,C,D,F,MP,SL; resOS=OrderSelect(0,SELECT_BY_POS,MODE_BASE); A=OrderOpenPrice(); B=OrderStopLoss(); C=OrderClosePrice(); D=B-A; SL=MathAbs(D*100000); F=C-A; MP=MathAbs(F*100000); if(MP>SL) { Alert("Close Position"); } return; }
That what i have now it works. Please need to know about that *100000 if this is right?
I think i should put it this way other wise he shows somthing like 0.0004 and not 43 Point
void start()//void MinimumProfit() { bool resOS; double A,B,C,D,F,MP,SL; resOS=OrderSelect(0,SELECT_BY_POS,MODE_BASE); A=OrderOpenPrice(); B=OrderStopLoss(); C=OrderClosePrice(); D=B-A; SL=MathAbs(D*Point); { Print("StopLoss",SL); } F=C-A; MP=MathAbs(F*Point); { Print("MinimumProfit",MP); } if(MP>SL) { Alert("Close Position"); } return;Than he shows 0 in the print?????????????
void start()//void MinimumProfit() { bool resOS; double A,B,C,D,F,MP,SL; resOS=OrderSelect(0,SELECT_BY_POS,MODE_BASE); A=OrderOpenPrice(); B=OrderStopLoss(); C=OrderClosePrice(); D=B-A; SL=MathAbs(D/Point); { Print("StopLoss",SL); } F=C-A; MP=MathAbs(F/Point); { Print("MinimumProfit",MP); } if(MP>SL) { Alert("Close Position"); } return;Got it , forgot dividing sorry and thanks a lot for u help
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
How do i get the Point amount caculation between OrderOpenPrice and StoppLoss in an open order?
thanks