المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : إكسبرت أوامر معلقة



Coder007
20-06-2018, 02:47 PM
London Breakout Strategy
On 1hr chart:
1.Check the highs and lows of last 3 candles at 8am UK time..
2. Place a Buy order +5 pips of the high. Stop at -5 pips of the low.
3. Place a Sell order -5 pips from the low and limit at +5 pips from the high.

Wait for one of the orders to be filled and cancel the other order. TP1 30 pips. TP2 50 pips

kira-h
21-06-2018, 12:04 PM
السلام عليكم
المرجو التوضيح بصور من الشارت

Coder007
23-06-2018, 03:03 PM
thank you for respond
On 1hr chart:
1.Check the highs and lows of last 3 candles at 8am UK time..
2. Place a Buy order +5 pips of the high. Stop at -5 pips of the low.
3. Place a Sell order -5 pips from the low and limit at +5 pips from the high.

Wait for one of the orders to be filled and cancel the other order. <---- . So we place 2 orders at 8am, 1 buy and 1 sell. If the buy order gets triggered we have to cancel the sell order. . Similarly if the Sell order gets filled, we have to cancel the buy order.

Coder007
23-06-2018, 03:10 PM
i tried to code it but i failed


extern int TakeProfit = 50; // Take profit points
extern double Stoplosspips =5.00; //Stop loss points



extern double Buypips = 5.00;
extern double Sellpips = 5.00;


extern double Lot = 0.01; // Lot Size
extern int MagicNumber = 06122018;// Magic Number
extern int Setofftime=8.00; // trading in specific time
extern int stoptime =12.00; // stop time






double close;
double minsltp;
double TP,SL;
double point;
int digits,Q;


int ThisBarTrade=0;
bool NewBar;


//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
if(Digits==5 || Digits==3)Q=10;
else Q=1;


if(Digits<4)
{
point=0.01;
digits=2;
}
else
{
point=0.0001;
digits=4;
}

minsltp=(MarketInfo(Symbol(),MODE_SPREAD)+MarketIn fo(Symbol(),MODE_STOPLEVEL)+1)/Q;
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---

}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
{ double High1=High[1];
double Highesthigh2=High[2];
double lowest=Low[1];
double lowest2=Low[2];


int h=TimeHour(TimeCurrent());

if ( h==Setofftime && Highesthigh2<High1 && orderscnt (OP_SELLSTOP)==0 ){

if(TakeProfit!=0){TP=Bid-TakeProfit*point;}else TP=0;
double Sell = OrderSend(NULL,OP_SELLSTOP,Lot,Low[1]-Sellpips*point,Q*5,High[1]-(Stoplosspips*point),TP,NULL,MagicNumber,0,clrRed) ;

}

if (h==Setofftime && lowest<lowest2 && orderscnt (OP_BUYSTOP)==0 ){

if(TakeProfit!=0){TP=Ask+TakeProfit*point;}else TP=0;
double Buy=OrderSend(NULL,OP_BUYSTOP,Lot,High[1]+Buypips*point,5*Q,Low[1]+(Stoplosspips*point),TP,NULL,MagicNumber,0,clrBlu e);

}

if (orderscnt(OP_BUYSTOP)==1){
CloseOrders(OP_SELL); }

if (orderscnt(OP_SELLSTOP) ==1){
CloseOrders(OP_BUY); }



}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+




int orderscnt(int tip)
{
int cnt=0;
for(int i=0;i<OrdersTotal();i++)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
if(OrderSymbol()==Symbol() && MagicNumber==OrderMagicNumber()&&OrderType()==tip)
{
cnt++;
}
}
return(cnt);
}



//-------------------------------------------------------------------+
void CloseOrders(int tip) {
int cnt=OrdersTotal();
for(int i=cnt-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
if(OrderSymbol()==Symbol()&& OrderMagicNumber()==MagicNumber&&OrderType()==tip)
{

close=OrderDelete(OrderTicket(),clrGreen);
}
}







}
//------------------------------------------