If you want help with developing your EA, you will need to show what you have done so far.
You also need to describe precisely what you need help with.
Ok, I try to explain better:
this is my buy at newBar after RSI signal:
result=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,0,0,0,"",MAGICMA,0,Blue);
and this is my sell at newBar after RSI signal:
result=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,0,0,0,"",MAGICMA,0,Red);
The problem is that the sell, open short position at price of new open bar (Open[0]) and this for me is ok, but the buy open long position at price that I understand...
Thank's for the help...
What's your question?
Do you want to know, why your code doesn't work?
Or do you want to know how it works?
The code for calculate next bar work fine.
I want to know how to buy at the opening price of the next bar and sell at the closing price of the bar...
Thank's
The code for calculate next bar work fine.
I want to know how to buy at the opening price of the next bar and sell at the closing price of the bar...
Thank's
You cannot guarantee to sell at the closing price of a bar. You don't know a bar has closed until the new bar opens, so you can only trade at the opening price of the new bar. And then you cannot guarantee that you will actually get that price due to slippage.
The command is like this:
result=OrderSend(Symbol(),OP_BUY,LotsOptimized(), Open[1],0,0,0,"",MAGICMA,0,Blue);
result=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Close[1],0,0,0,"",MAGICMA,0,Red);
traderforlife:
OrderSend with OP_BUY or OP_SELL at price of open current bar. OrderClose at price of close current bar. |
|
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello, I'm newbie, but I'm trying to develop an EA.
I would like to open long or short positions on the basis of my signal at determinate price.
in particular:
OrderSend with OP_BUY or OP_SELL at price of open current bar.
OrderClose at price of close current bar.
Thank's a lot...