Или хотя бы в самом терминале писал в окне графика
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
string Result()
{
string s="";
for(int i=OrdersHistoryTotal()-1;i>=OrdersHistoryTotal()-Count;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
{
if(OrderType()<2)
{
s+="\n "+(string)(NormalizeDouble((OrderOpenPrice()-OrderClosePrice())/_Point,0));
}
}
}
}
return(s);
}
//+------------------------------------------------------------------+
//| Random.mq4 |
//| Copyright 2017, AM2 |
//| http://www.forexsyatems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, AM2."
#property link "http://www.forexsyatems.biz"
#property version "1.00"
#property strict
//--- Inputs
extern double Lots = 0.1; // лот
extern int StopLoss = 400; // лось
extern int TakeProfit = 500; // язь
extern int Count = 4; // сколько сделок печатаем
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,Lots,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);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
string Result()
{
string s="";
for(int i=OrdersHistoryTotal()-1;i>=OrdersHistoryTotal()-Count;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
{
if(OrderType()<2)
{
s+="\n "+(string)(NormalizeDouble((OrderOpenPrice()-OrderClosePrice())/_Point,0));
}
}
}
}
return(s);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
int type=(int)MathMod(MathRand(),2);
if(CountTrades()<1)
{
if(type==0) PutOrder(0,Ask);
if(type==1) PutOrder(1,Bid);
}
Comment("\n Results: ",Result());
}
//+------------------------------------------------------------------+
double Lot()
{
double lot=Lots;
if(Lots==0)lot=NormalizeDouble(AccountEquity()*Risk/100000,2);
if(lot<MarketInfo(NULL,MODE_MINLOT)) lot=MarketInfo(NULL,MODE_MINLOT);
if(lot>MarketInfo(NULL,MODE_MAXLOT)) lot=MarketInfo(NULL,MODE_MAXLOT);
return(lot);
}
т.е если выбрать в советнике атр 14, (атр с периодом 14 по MN1 равен 500 пунктов(например)) тогда должны выводиться лимитные ордера от хая(верха) месяца 500 пунктов вниз — сделка на покупку и от лоу(самый низ месяца) 500 пунктов вверх — сделка на продажу.
Прошу в советник добавить фильтры которые бы уменьшили просадку
AM2