SIMONE MARELLI: Nono, the ideas is to move sl when
price is more than 20 pips in profit. That's for trailing, and trailing was working correctly. The only problem is the reversing. I just
need to reverse the order at stoploss, I have made a test and it's not working, so I am looking for a better way
Oh sorry.
For modify, e.g. buy = Bid>OrderOpenPrice + 200 points and for sell = Ask<OrderOpenPrice - 200 points
For reverse order: Buy reverse = (on sell order: OrderClosePrice>OrderOpenPrice + 200 points) - The order has already lost 200
points
and Sell reverse = (on buy order: OrderClosePrice<OrderOpenPrice - 200 points) - The order has already lost 200 points.
SIMONE MARELLI: Can someone help me on the
reversing?
I think is better to check the history orders.
Compare order close price with orders stop loss, or check orders
comment for [sl].
for(int i=OrdersHistoryTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
{
if((StringFind(OrderComment(), "[sl]", 0)>-1) && (TimeCurrent()-OrderCloseTime()<10)) then open reverse order...
}
if(i==OrdersHistoryTotal()-2) break;//Check only last order
}
Requests to execute trade operations are formalized as orders. Each order has a variety of properties for reading. Information on them can be obtained using functions Position identifier that is set to an order as soon as it is executed. Each executed order results in a deal that opens or modifies an already existing position. The...
SIMONE MARELLI: Can someone help me on the
reversing?
Maybe this way.
//Reverse order for the BUYfor (int b= OrdersTotal()-1; b>=0; b--)
{
if(OrderSelect(b,SELECT_BY_POS,MODE_TRADES))
if(OrderSymbol()==Symbol())
if(OrderType()==OP_BUY)
{
if(OrderClosePrice()<= OrderOpenPrice()-(550*_Point))
{
Alert("StopLoss almost reached on " +Symbol() + " order is now reversed");
int secondticket = OrderSend(_Symbol,OP_SELL,Lots*2,Bid,3,Ask+600*_Point,Bid-400*_Point,"Renko Sell Order",MagicNumber,0,Red);
Sleep(60000);
}
}
}
//Reverse order for the SELL for (int b= OrdersTotal()-1; b>=0; b--)
{
if(OrderSelect(b,SELECT_BY_POS,MODE_TRADES))
if(OrderSymbol()==Symbol())
if(OrderType()==OP_SELL)
{
if(OrderClosePrice() >= OrderOpenPrice()+(550*_Point))
{
Alert("StopLoss almost reached on " +Symbol() + " order is now reversed");
int secondticket2 = OrderSend(_Symbol,OP_BUY,Lots*2,Ask,3,Bid-600*_Point,Ask+400*_Point,"Renko Buy Order",MagicNumber,0,Green);
Sleep(60000);
}
}
}
Nono, the ideas is to move sl when price is more than 20 pips in profit. That's for trailing, and trailing was working correctly. The only problem is the reversing. I just need to reverse the order at stoploss, I have made a test and it's not working, so I am looking for a better way
Oh sorry.
For modify, e.g. buy = Bid>OrderOpenPrice + 200 points and for sell = Ask<OrderOpenPrice - 200 points
For reverse order: Buy reverse = (on sell order: OrderClosePrice>OrderOpenPrice + 200 points) - The order has already lost 200 points
and Sell reverse = (on buy order: OrderClosePrice<OrderOpenPrice - 200 points) - The order has already lost 200 points.
Oh sorry.
For modify, e.g. buy = Bid>OrderOpenPrice + 200 points and for sell = Ask<OrderOpenPrice - 200 points
For reverse order: Buy reverse = (on sell order: OrderClosePrice>OrderOpenPrice + 200 points) - The order has already lost 200 points
and Sell reverse = (on buy order: OrderClosePrice<OrderOpenPrice - 200 points) - The order has already lost 200 points.
Mmm, other guys has wrote exactly the opposite things. Always more confused
Can someone help me on the reversing?
I think is better to check the history orders.
Compare order close price with orders stop loss, or check orders comment for [sl].
Can someone help me on the reversing?
Maybe this way.