Try this:
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,10,Bid+StopLoss*Point, Bid-TakeProfit*Point,"pip-catcher SHORT",12345,0,Red);
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,10, Ask-StopLoss*Point, Ask+TakeProfit*Point,"pip-catcher LONG",12345,0,Green);
i'm trying to write my own EA, but ran into confusion
extern double TakeProfit=25.0;
extern double StopLoss=20.0;
extern double Lots=0.1;
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,10,StopLoss,Bid-TakeProfit*Point,"pip-catcher SHORT",12345,0,Red);
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,10,StopLoss,Ask+TakeProfit*Point,"pip-catcher LONG",12345,0,Green);
To me, it looks allright, but when i run it on StrategyTester 1H EUR/USD Open Prices only. When it try's to open position, it shows error - invalid stops


Actually it still keeps giving invalid stops on every order
but i chanced these to
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+0.0020,Bid-0.0030,"pip-catcher SHORT",12345,0,Red);
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-0.0020,Ask+0.0030,"pip-catcher LONG",12345,0,Green);
and seems that this way works, theoreticaly that should be same
Hi,
I'm trying to use OrderSend to buy or sell, but without using any trailing stop or stoploss? What is the value to use? 0, or NULL ?
I had set them to 9000 for example, but if I buy 0.1 lot, then it always closes my trades at 900 or -900.
What am I doing wrong?
Daniel

- 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'm trying to write my own EA, but ran into confusion
extern double TakeProfit=25.0;
extern double StopLoss=20.0;
extern double Lots=0.1;
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,10,StopLoss,Bid-TakeProfit*Point,"pip-catcher SHORT",12345,0,Red);
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,10,StopLoss,Ask+TakeProfit*Point,"pip-catcher LONG",12345,0,Green);
To me, it looks allright, but when i run it on StrategyTester 1H EUR/USD Open Prices only. When it try's to open position, it shows error - invalid stops
means that stoploss and takeprofit are wrong? When i change those something else(bigger,smaller) or writing number out insteed of Stoploss or TakeProfit inside OrderSend, but still the same invalid stops
any help, i'm getting angry against MQL4 already 