- "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
- Most likely "unmatched data errors."
- "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
- Most likely "unmatched data errors."
LoL .
No , it's not the ummatched data errors .
In this case I try with the EURUSD .. fine No errors ...
But , after this I change the Symbol , and this is whats happen
- What part of "There are no mind readers here" was unclear? How should we know what is wrong with your code (130) when we can't see it?
- Most likely you are not adjusting pips for JPY.
- What part of "There are no mind readers here" was unclear? How should we know what is wrong with your code (130) when we can't see it?
- Most likely you are not adjusting pips for JPY.
Pips are adjusted for the 5 and 3 digits !
This is the code :void Trailingstop { double tssl,tbsl; for( int b = OrdersTotal()-1; b>=0; b-- ) { if(OrderSelect( b, SELECT_BY_POS, MODE_TRADES)&&OrderMagicNumber() == magicNumber&&OrderSymbol() == Symbol()) { if(OrderType() == OP_BUY) { if(Bid - OrderOpenPrice()>(WhenToTrail+0.5)*pips && OrderStopLoss()<Bid - (TrailAmount+0.5)*pips )/*&bsl != OrderStopLoss()*/ { tbsl=Bid-TrailAmount*pips; if (MathAbs( tbsl-Bid ) <stoplevel*pips) { tbsl=Bid-stoplevel*pips; } if (!OrderModify( OrderTicket(), OrderOpenPrice(), tbsl, OrderTakeProfit(), 0, CLR_NONE )) { Print("Buy Order Modify TS Error n° ", GetLastError()," . Bid - TrailAmount*pips = ",Bid - TrailAmount*pips ," . The Bid = ",Bid); } } } if(OrderType() == OP_SELL) { if(OrderOpenPrice() - Ask >(WhenToTrail+0.5)*pips && (OrderStopLoss() >Ask + (TrailAmount+0.5)*pips || OrderStopLoss() == 0)) { tssl=Ask+TrailAmount*pips; if(MathAbs( tssl-Ask ) <stoplevel*pips) { tssl=Ask+stoplevel*pips; } if (!OrderModify( OrderTicket(), OrderOpenPrice(), tssl , OrderTakeProfit(), 0, CLR_NONE )) { Print("Sell Order Modify TS Error n° ", GetLastError()," . Ask + TrailAmount*pips = ",Ask + TrailAmount*pips," . The Ask = ",Ask); } //} } } } } }
tbsl=Bid-TrailAmount*pips; if (MathAbs( tbsl-Bid ) <stoplevel*pips)
- What part of "There are no mind readers here" was unclear?
- How should we know what pips is when we can't see it?
- How should what know what stoplevel is when we can't see it? If it's MarketInfo(MODE_STOPLEVEL) which is the minimum number of points, why are you multiplying it by pips?
There is Tick, PIP, and Point. They are all different in general. A tick is the smallest change of price. A Point is the least significant digit quoted. In currencies a pip is defined as 0.0001 (or for JPY 0.01)
On a 4 digit broker a point (0.0001) = pip (0.0001). [JPY 0.01 == 0.01] On a 5 digit broker a point (0.00001) = 1/10 pip (0.00010/10). Just because you quote an extra digit doesn't change the value of a pip. (0.0001 == 0.00010) EA's must adjust pips to points (for mq4.) In currencies a tick is a point. Price can change by least significant digit (1.23456 -> 1.23457)
In metals a Tick is still the smallest change but is larger than a point. If price can change from 123.25 to 123.50, you have a TickSize of 0.25 and a point of 0.01. Pip has no meaning.
This is why you don't use TickValue by itself. Only as a ratio with TickSize. See DeltaValuePerLot()
if(MathAbs( tssl-Ask ) <stoplevel*pips) { tssl=Ask+stoplevel*pips; }
I test if the stoploss is too close to stoplevel !!!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I test my EA on the strategy tester with EURUSD , and it works , but when I test it with another symbol , it shows me a huge number of error , I try to close all the windows in the metatrader and restart it and try with another symbol ,it works , what confusing me , why didn't work from the first time .
Thanks in advance.