problem with Array,Close,Opposite transaction
kot_filemon:
Hello,
Can anybody help me with EA? I have few question:
<CODE REMOVED>
Please read some other posts before posting . . .
Please edit your post . . . please use the SRC button to post code: How to use the SRC button.
I read, but didn't find answer.
kot_filemon:
I read, but didn't find answer.
I read, but didn't find answer.
Why didn't you read all the posts I made asking people to use the SRC button to post code ?
Why didn't you edit your post using the SRC button ?
Hello,
Can anybody help me with EA? I have few question:
case 1.
In need use candles from 0 to 9 in an EA.
double x=iClose(0,PERIOD_M10,0);
double y=iClose(0,PERIOD_M10,9);
Is it mean:
a. two candles first and tenth
b. all 10 candles from first to tenth (all array-10 candles)
case 2.
Using code below every open order is close after tick and open next one (the same direction). Can you explain why?
for(int i=0;i<OrdersTotal();i++)
{ if (OrderSelect(i,SELECT_BY_POS,MODE_TRANS)==true)
{ if (OrderType()==OP_BUY)OrderClose(OrderTicket(),OrderLots(),Bid,2);
if (OrderType()==OP_SELL)OrderClose(OrderTicket(),OrderLots(),Ask,2);}}
but if I use:
if (OrdersTotal()>0){return(0);}
everything is ok.
case 3.
Using code below EA doesn't open opposite transaction after close earlier (the same time). Should I use OrderCloseBy() ? but I don't think so. If I use SL and TP transaction could be done properly depends on conditons of entry.
if (MA_S>MA_W)OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0);
if (MA_S<MA_W)OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0);
case 4.
If I has SL and TP in code from case 3 why EA can't close open position before Sl or TP will be realize even changed entry conditions and should change direction? Can anybody explain it to me, because I can't find answer for my question in the manual.
Thank you very much for help and sorry if my question are double.