I want too save time during backtests, so I only want to check it in OnInit(). Is that possible?
Sadly the following doesnt work:(
intOnInit()
{StartOrder =OrderSend (Symbol(),OP_BUY,Lot,Ask,10,0,0,"StartOrder",EA1_MagicNummer,0,Orange); //<-for testing purposes
Set_SL=OrderModify (OrderSelect(StartOrder,SELECT_BY_TICKET),OrderOpenPrice(),NormalizeDouble(OrderOpenPrice()/(1+(0.2/100)),Digits),OrderTakeProfit(),0,Yellow);
int total=OrdersTotal();
if(total==0) {
return (ShortOrders=0);
return (LongOrders=0);
}
elseif (total>0){
for(int Ordercount=0; Ordercount<=total; Ordercount++)
{
if(OrderSelect(Ordercount,SELECT_BY_POS,MODE_TRADES) && OrderMagicNumber()==EA1_MagicNummer && OrderType()==OP_BUY){LongOrders++;LongTicket=OrderTicket();}
if(OrderSelect(Ordercount,SELECT_BY_POS,MODE_TRADES) && OrderMagicNumber()==EA1_MagicNummer && OrderType()==OP_SELL){ShortOrders++;ShortTicket=OrderTicket();}
}
return (LongOrders);
return (ShortOrders);}
//---return(INIT_SUCCEEDED)
;
return (ShortOrders);Print (ShortOrders);
return (LongOrders);Print (LongOrders);
//is that Possible? I mean to get 2 Return values? And how can I return the "LongTicket" from ^straight above there -> ^^^^^^ (I need them later for an Ordermodify)
voidOnTick(){
if (LongOrders==0){
LongOrderSend=OrderSend(Symbol(),OP_BUY,Lot,Bid,10,0,0,"einfach Long",EA1_MagicNummer,0,Blue);
LongOrders++;
}
{if (ShortOrders==0){
ShortOrderSend=OrderSend(Symbol(),OP_SELL,Lot,Ask,10,0,0,"einfach Long",EA1_MagicNummer,0,Blue);}
ShortOrders++;
}
//---
}
Or is there another way to :
Check the Count of Long & Short Orders with the right MagicNumber ->>> and choose exactly those Orders to Modyfy them (for example via Ticket) <--- AND all this with minimum Code ??
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
read above...
I want too save time during backtests, so I only want to check it in OnInit(). Is that possible?
Sadly the following doesnt work:(
Or is there another way to :
Check the Count of Long & Short Orders with the right MagicNumber ->>> and choose exactly those Orders to Modyfy them (for example via Ticket) <--- AND all this with minimum Code ??