You are on page 1of 1

#property show_inputs

//--------------------------------------------------------------------
extern int ������ = 20;
extern int n = 3; //limits orders
extern int Candle = 1; //wich candle
extern double Lot = 0.01; //lot
extern int Magic = 0; //
//extern bool comment = false; //�������� ��������� �� �����
//--------------------------------------------------------------------
int start()
{
double SL,TP,delta,Price0,Price_n;
double Price = NormalizeDouble(WindowPriceOnDropped(),Digits);
delta = NormalizeDouble((High[Candle]-Low[Candle])/(n+1),Digits);
RefreshRates();
if(Price>Ask)
{
// ��������� ������� buystop
Price0 = NormalizeDouble(High[Candle]+������*Point,Digits);
TP = (High[Candle]*2-Low[Candle]);
SL = NormalizeDouble(Low[Candle]-������*Point,Digits);

OrderSend(Symbol(),OP_BUYSTOP,Lot,Price0,0,SL,TP,"StopOrders",Magic,0,CLR_NONE);

// ��������� �������������� buylimit orders


for (int i=1;i<=n;i++)
{
Price_n = NormalizeDouble(High[Candle] - delta*i,Digits);

OrderSend(Symbol(),OP_BUYLIMIT,Lot*(i+1),Price_n,0,SL,TP,"LimitOrders",Magic,0,CLR_
NONE);
}
}

if(Price<Bid)
{
// ��������� ������� sellstop
Price0 = NormalizeDouble(Low[Candle]-������*Point,Digits);
TP = (Low[Candle]*2-High[Candle]);
SL = NormalizeDouble(High[Candle]+������*Point,Digits);

OrderSend(Symbol(),OP_SELLSTOP,Lot,Price0,0,SL,TP,"StopOrders",Magic,0,CLR_NONE);

// ��������� �������������� sell-limit orders


for (i=1;i<=n;i++)
{
Price_n = NormalizeDouble(Low[Candle] + delta*i,Digits);

OrderSend(Symbol(),OP_SELLLIMIT,Lot*(i+1),Price_n,0,SL,TP,"LimitOrders",Magic,0,CLR
_NONE);
}

return(0);
}
//--------------------------------------------------------------------

You might also like