
//+------------------------------------------------------------------+
//| Parabolic2.mq4 |
//| Copyright 2019, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, AM2"
#property link "http://www.forexsystems.biz"
#property version "1.00"
#property strict
//--- Inputs
extern double Lot1 = 0.2; // лот 1
extern double Lot2 = 0.4; // лот 2
extern int StopLoss1 = 333; // лось 1
extern int TakeProfit1 = 444; // язь 1
extern int StopLoss2 = 222; // лось 2
extern int TakeProfit2 = 333; // язь 2
extern int Reverse = 0; // 1-реверс
extern int Slip = 30; // реквот
extern int Shift = 1; // на каком баре сигнал индикатора
extern int Magic = 123; // магик
extern double Step1 = 0.0027; //
extern double Maximum1 = 0.5; //
extern double Step2 = 0.027; //
extern double Maximum2 = 0.5; //
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
Comment("");
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
Comment("");
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void PutOrder(int type,double price, double st, double tk, double lt)
{
int r=0;
color clr=Green;
double sl=0,tp=0;
if(type==1 || type==3 || type==5)
{
clr=Red;
if(st>0)
sl=NormalizeDouble(price+st*Point,Digits);
if(tk>0)
tp=NormalizeDouble(price-tk*Point,Digits);
}
if(type==0 || type==2 || type==4)
{
clr=Blue;
if(st>0)
sl=NormalizeDouble(price-st*Point,Digits);
if(tk>0)
tp=NormalizeDouble(price+tk*Point,Digits);
}
r=OrderSend(NULL,type,lt,NormalizeDouble(price,Digits),Slip,sl,tp,"",Magic,0,clr);
return;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
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()<2)
count++;
}
}
}
return(count);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void OpenPos()
{
double sar1=iSAR(NULL,0,Step1,Maximum1,Shift);
double sar12=iSAR(NULL,0,Step2,Maximum2,Shift);
double sar22=iSAR(NULL,0,Step2,Maximum2,Shift+1);
if(Reverse>0)
{
if(sar1>Bid && sar12>Bid && sar22<Bid)
{
PutOrder(0,Ask,StopLoss1,TakeProfit1,Lot1);
PutOrder(0,Ask,StopLoss2,TakeProfit2,Lot2);
}
if(sar1<Bid && sar12<Bid && sar22>Bid)
{
PutOrder(1,Bid,StopLoss1,TakeProfit1,Lot1);
PutOrder(1,Bid,StopLoss2,TakeProfit2,Lot2);
}
}
if(Reverse<1)
{
if(sar1<Bid && sar12<Bid && sar22>Bid)
{
PutOrder(0,Ask,StopLoss1,TakeProfit1,Lot1);
PutOrder(0,Ask,StopLoss2,TakeProfit2,Lot2);
}
if(sar1>Bid && sar12>Bid && sar22<Bid)
{
PutOrder(1,Bid,StopLoss1,TakeProfit1,Lot1);
PutOrder(1,Bid,StopLoss2,TakeProfit2,Lot2);
}
}
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
if(CountTrades()<1)
OpenPos();
}
//+------------------------------------------------------------------+
сделайте по возможности тейк для 10-ти колен!
исправьте пожалуйста.
Странно, почему вы решили написать с нуля???
Странно, почему вы решили написать с нуля???
а у кого из топ 10 кодеров на мкл они есть?
AM2