
Удаление ордеров, есть. Спросите по указанной мной ссылке на фриланс, сколько будет стоить сделать такой советник с нуля, мне просто интересно![]()
После этого добавлю остальное.
Да ведите пожалуйста советника до ума до 100 % соответствия и я вас заплачу 50 баксов.
чтобы он открывал ордера на каждой свечи и в зависимости от предыдущей только, если был рост, то открываем селл и наоборот.
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
#property link "http://traders-union.ru/?ref=25250" //
// ВНИМАНИЕ //
//Для партнеров группы в "МОФТ" (Международное Обьеденение //
//Форкс Трейдеров) пишу советники бесплатно и предлагаю несколько //
//рабочих вариантов. Скайп Voldemar227 ICQ 155553959 //
//////////////////////////////////////////////////////////////////////
extern string МОФТ="http://traders-union.ru/?ref=25250";
extern double Lots = 0.1;
extern int Distanciya_min = 1;
extern int Distanciya_max = 800;
extern int slip = 3;
extern int Chas = 60;
extern int Magic=227;
int time;
double bdi,sdi,LastOpen;
//==============================================================================//
int start()
{
//==============================================================================//
// Обуляем переменные
//==============================================================================//
int up=0,dw=0,v=0,c=0,q=0,p=0;
//==============================================================================//
// Поиск ордеров
//==============================================================================//
int total=OrdersTotal();
int b=0,s=0,bb=0,ss=0;
for(int i=total-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS))
{
if(OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY && OrderMagicNumber()==Magic)
{
b++;
}
if(OrderType()==OP_SELL && OrderMagicNumber()==Magic)
{
s++;
}
}
}
}
//==============================================================================//
// Условия открытия
//==============================================================================//
int vremya =Chas*60;
double ask =NormalizeDouble(Ask,Digits);
double bid =NormalizeDouble(Bid,Digits);
double dis_min=NormalizeDouble(Distanciya_min*Point,Digits);
double dis_max=NormalizeDouble(Distanciya_max*Point,Digits);
double close =iClose(NULL,Period(),1);
double max =iHigh (NULL,Period(),1);
double open =iOpen (NULL,Period(),1);
double min =iLow (NULL,Period(),1);
if(close>open) {bdi=close-open; q=1;}
if(close<open) {sdi=open-close; p=1;}
if(bdi>dis_min&&bdi<dis_max){v=1;}
if(sdi>dis_min&&sdi<dis_max){c=1;}
if(q==1&&v==1){up=1;}
if(p==1&&c==1){dw=1;}
//==============================================================================//
// Условия открытия конец
//==============================================================================//
// Открываем ордера
//==============================================================================//
if(LastOpen!=Open[0])
{
if(p==1)
{
int r=OrderSend(Symbol(),OP_BUY,Lots,ask,slip,0,0,NULL,Magic,0,CLR_NONE);
}
if(q==1)
{
r=OrderSend(Symbol(),OP_SELL,Lots,bid,slip,0,0,NULL,Magic,0,CLR_NONE);
}
}
LastOpen=Open[0];
//==============================================================================//
// Конец открытия ордеров
//==============================================================================//
//
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| ExBB.mq4 |
//| Copyright 2015, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2015, AM2"
#property link "http://www.forexsystems.biz"
#property description "BBands expert advisor"
//--- Inputs
extern double Lots = 0.1; // лот
extern double MaxLot = 5; // максимальный лот
extern double KLot = 2; // умножение лота
extern int StopLoss = 500; // лось
extern int TakeProfit = 500; // язь
extern int Slip = 30; // слипаж
//----
extern int Length = 20; // период BB
extern double Deviation = 2; // отклонение ВВ
extern int Magic = 20; // магик
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Check for open order conditions |
//+------------------------------------------------------------------+
void OpenPos()
{
int res;
//--- get Ind
double BBBlue=iCustom(Symbol(),0,"BBands_Stop_v1",Length,Deviation,0,1);
double BBRed=iCustom(Symbol(),0,"BBands_Stop_v1",Length,Deviation,1,1);
//--- sell conditions
if(BBRed>0 && (LastDealType()==1 || LastDealType()==0))
{
res=OrderSend(Symbol(),OP_SELL,Lot(),NormalizeDouble(Bid,Digits),
Slip,NormalizeDouble(Bid+StopLoss*Point,Digits),
NormalizeDouble(Bid-TakeProfit*Point,Digits),"",Magic ,0,Red);
return;
}
//--- buy conditions
if(BBBlue>0 && (LastDealType()==2 || LastDealType()==0))
{
res=OrderSend(Symbol(),OP_BUY,Lot(),NormalizeDouble(Ask,Digits),
Slip,NormalizeDouble(Ask-StopLoss*Point,Digits),
NormalizeDouble(Ask+TakeProfit*Point,Digits),"",Magic ,0,Blue);
return;
}
//---
}
//+------------------------------------------------------------------+
//| Check for close order conditions |
//+------------------------------------------------------------------+
void ClosePos()
{
//--- get Ind
double BBBlue=iCustom(Symbol(),0,"BBands_Stop_v1",Length,Deviation,0,1);
double BBRed=iCustom(Symbol(),0,"BBands_Stop_v1",Length,Deviation,1,1);
//---
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderMagicNumber()!=Magic || OrderSymbol()!=Symbol()) continue;
//--- check order type
if(OrderType()==OP_BUY)
{
if(BBRed>0)
{
if(!OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),Slip,White))
Print("OrderClose error ",GetLastError());
}
break;
}
if(OrderType()==OP_SELL)
{
if(BBBlue>0)
{
if(!OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),Slip,White))
Print("OrderClose error ",GetLastError());
}
break;
}
}
//---
}
//+------------------------------------------------------------------+
int CountTrades()
{
int count=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
{
if(OrderType()==OP_BUY || OrderType()==OP_SELL)
count++;
}
}
}
return(count);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int LastDealType()
{
int type=0;
if(OrdersHistoryTotal()==0)
{
type=0;
}
if(OrderSelect(OrdersHistoryTotal()-1,SELECT_BY_POS,MODE_HISTORY))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
{
if(OrderType()==OP_BUY)
{
type=1;//buy
}
if(OrderType()==OP_SELL)
{
type=2;//sell
}
}
}
return(type);
}
//+------------------------------------------------------------------+
//| Calculate optimal lot size |
//+------------------------------------------------------------------+
double Lot()
{
double lot;
if(OrdersHistoryTotal()==0)
{
lot=Lots;
}
if(OrderSelect(OrdersHistoryTotal()-1,SELECT_BY_POS,MODE_HISTORY))
{
if(OrderProfit()>0)
{
lot=Lots;
}
if(OrderProfit()<=0)
{
lot=OrderLots()*KLot;
}
}
if(lot>MaxLot)lot=Lots;
return(lot);
}
//+------------------------------------------------------------------+
//| OnTick function |
//+------------------------------------------------------------------+
void OnTick()
{
if(CountTrades()<1) OpenPos();
else ClosePos();
}
//+------------------------------------------------------------------+
Buy Stop=true//false
0.00=true//false
23.6=true//false
38.2=true//false
50.0=true//false
61.8=true//false
78.6=true//false
100.0=true//false
Sell Stop=true//false
0.00=true//false
23.6=true//false
38.2=true//false
50.0=true//false
61.8=true//false
78.6=true//false
100.0=true//false
Buy Limit=true//false
0.00=true//false
23.6=true//false
38.2=true//false
50.0=true//false
61.8=true//false
78.6=true//false
100.0=true//false
Sell Limit=true//false
0.00=true//false
23.6=true//false
38.2=true//false
50.0=true//false
61.8=true//false
78.6=true//false
100.0=true//false
Также с возможностью при выставлении нового отложенного ордера отступа от цены в % от уровня фибо. Также чтобы можно было одновременно выставить отложенный ордер допустим buy limit и sell stop на разных уровнях или допустим sell limit и sell stop также с возможностью выбирать любые уровни фибо. Спасибо!
AM2