
Как в анекдоте про Баден Баден

«Летит самолет, в самолете сидит новый русский, стюардесса обявляет:
— Господа пассажиры, через несколько минут мы приземляемся в городе Баден-Баден.
Новый русский:
— Ты что за лохов нас держишь 2 раза повторяешь!»
«Летит самолет, в самолете сидит новый русский, стюардесса обявляет:
— Господа пассажиры, через несколько минут мы приземляемся в городе Баден-Баден.
Новый русский:
— Ты что за лохов нас держишь 2 раза повторяешь!»
Внимание! Одно из основных условий — заказы принимаются в бесплатную работу только с 3-го уровня и не более 1 заказа в месяц. Однако, даже если у Вас нет нужного уровня, Вы можете воспользоваться поручительством другого пользователя (см. пункт 1.7)
Подробнее в правилах ниже.
Надеюсь в этот раз советник будет сделан
//+------------------------------------------------------------------+
//| Simple.mq4 |
//| Copyright 2017, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, AM2"
#property link "http://www.forexsystems.biz"
#property version "1.00"
#property strict
//--- Inputs
extern double Lots = 0.1; // лот
extern double KLot = 2; // умножение лота
extern double MaxLot = 5; // максимальный лот
extern int StopLoss = 300; // лось
extern int TakeProfit = 400; // язь
extern int Slip = 30; // реквот
extern int Magic = 123; // магик
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
Comment("");
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
Comment("");
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void PutOrder(int type,double price)
{
int r=0;
color clr=Green;
double sl=0,tp=0;
if(type==1 || type==3 || type==5)
{
clr=Red;
if(StopLoss>0) sl=NormalizeDouble(price+StopLoss*Point,Digits);
if(TakeProfit>0) tp=NormalizeDouble(price-TakeProfit*Point,Digits);
}
if(type==0 || type==2 || type==4)
{
clr=Blue;
if(StopLoss>0) sl=NormalizeDouble(price-StopLoss*Point,Digits);
if(TakeProfit>0) tp=NormalizeDouble(price+TakeProfit*Point,Digits);
}
r=OrderSend(NULL,type,Lot(),NormalizeDouble(price,Digits),Slip,sl,tp,"",Magic,0,clr);
return;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double Lot()
{
double lot=Lots;
for(int i=OrdersHistoryTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
{
if(OrderProfit()<0)
{
lot=OrderLots()*KLot;
}
break;
}
}
}
if(lot>MaxLot)lot=MaxLot;
return(lot);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
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);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
if(CountTrades()<1)
{
PutOrder(0,Ask);
PutOrder(1,Bid);
}
}
//+------------------------------------------------------------------+
extern int MMType=1;
extern bool UseClose=FALSE;
extern bool UseAdd=TRUE;
extern bool NewBar=TRUE;
extern double LotExponent=1.667;
extern double slip = 3.0;
extern double Lots = 0.01;
extern double LotsDigits = 2.0;
extern double TakeProfit = 10.0;
double gd_128 = 500.0;
double gd_136 = 10.0;
double gd_144 = 10.0;
extern double PipStep= 30.0;
extern int MaxTrades = 10;
extern bool UseEquityStop=FALSE;
extern double TotalEquityRisk=20.0;
extern bool UseTrailingStop=FALSE;
extern bool UseTimeOut=FALSE;
extern double MaxTradeOpenHours=48.0;
int gi_192=12324;
double gd_196;
double gd_204;
double gd_212;
double gd_220;
double gd_228;
double gd_236;
double gd_244;
double gd_252;
double gd_260;
double gd_276;
bool gi_284;
string gs_288="Помощник";
int gt_296=0;
int gi_300;
int gi_304=0;
double gd_308;
int gi_316=0;
int gi_320;
double gd_324=0.0;
bool gi_332 = FALSE;
bool gi_336 = FALSE;
bool gi_340 = FALSE;
int gi_344;
bool gi_348= FALSE;
int gi_352 = 0;
int gi_356 = 0;
double gd_360;
double gd_368;
bool s,c,m;
//+------------------------------------------------------------------+
//| Contract.mq4 |
//| Copyright 2017, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, AM2"
#property link "http://www.forexsystems.biz"
#property version "1.00"
#property strict
//--- Inputs
extern double Lots = 0.1; // лот
extern double KLot = 1; // умножение лота
extern double MaxLot = 5; // максимальный лот
extern int StopLoss = 111; // лось
extern int TakeProfit = 111; // язь
extern int Shift = 1; // на каком баре сигнал индикатора
extern int Magic = 123; // магик
extern string IndName = "##Contrast-mtf";
input double coeff = 0;
input string TimeFrame1 = "Current time frame";
input string TimeFrame2 = "next1";
input string TimeFrame3 = "next2";
input string TimeFrame4 = "next3";
input int LinesWidth = 0;
input color LabelsColor = DarkGray;
input int LabelsHorizontalShift = 3;
input double LabelsVerticalShift = 1.6;
datetime t=0;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
Comment("");
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
Comment("");
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void PutOrder(int type,double price)
{
int r=0;
color clr=Green;
double sl=0,tp=0;
if(type==1 || type==3 || type==5)
{
clr=Red;
if(StopLoss>0) sl=NormalizeDouble(price+StopLoss*Point,Digits);
if(TakeProfit>0) tp=NormalizeDouble(price-TakeProfit*Point,Digits);
}
if(type==0 || type==2 || type==4)
{
clr=Blue;
if(StopLoss>0) sl=NormalizeDouble(price-StopLoss*Point,Digits);
if(TakeProfit>0) tp=NormalizeDouble(price+TakeProfit*Point,Digits);
}
r=OrderSend(NULL,type,Lot(),NormalizeDouble(price,Digits),0,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 r1 = iCustom(NULL,0,IndName,coeff,TimeFrame1,TimeFrame2,TimeFrame3,TimeFrame4,LinesWidth,LabelsColor,LabelsHorizontalShift,LabelsVerticalShift,0,Shift);
double g1 = iCustom(NULL,0,IndName,coeff,TimeFrame1,TimeFrame2,TimeFrame3,TimeFrame4,LinesWidth,LabelsColor,LabelsHorizontalShift,LabelsVerticalShift,1,Shift);
if(g1<r1)
{
PutOrder(0,Ask);
}
if(g1>r1)
{
PutOrder(1,Bid);
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double Lot()
{
double lot=Lots;
for(int i=OrdersHistoryTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
{
if(OrderProfit()>0) break;
if(OrderProfit()<0)
{
lot=OrderLots()*KLot;
break;
}
}
}
if(lot>MaxLot)lot=Lots;
return(lot);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
double r = iCustom(NULL,0,IndName,coeff,TimeFrame1,TimeFrame2,TimeFrame3,TimeFrame4,LinesWidth,LabelsColor,LabelsHorizontalShift,LabelsVerticalShift,0,Shift);
double g = iCustom(NULL,0,IndName,coeff,TimeFrame1,TimeFrame2,TimeFrame3,TimeFrame4,LinesWidth,LabelsColor,LabelsHorizontalShift,LabelsVerticalShift,1,Shift);
if(CountTrades()<1 && t!=Time[0])
{
OpenPos();
t=Time[0];
}
Comment("\n red: ",r,
"\n green: ",g);
}
//+------------------------------------------------------------------+
AM2