благодарю, заценим
, 2тыс строчек кода почти =)))
<code>
//+------------------------------------------------------------------+
//| FractalMA.mq4 |
//| Copyright 2019, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, AM2&&cerber04"
#property link "http://www.forexsystems.biz"
#property version "1.01"
#property strict
#property indicator_chart_window
#property description "Сигнал после фрактала на второй свече"
#property indicator_buffers 2
//доработан cerber04
double up[];
double dn[];
extern int fr=4;
//бар после которого сигнал
extern int MAPeriod=28;
input int MAShift=0;
extern int MAMethod=MODE_SMA;
extern int MAPrice=0;
input int BarsCount=1111;
//Цена быстрой МА: 0-Close, 1-Open, 2-High, 3-Low, 4-Median, 5-Typical, 6-Weighted
//input bool Alerts=0;
datetime t=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
SetIndexStyle(0,DRAW_ARROW,0,1,Lime);
SetIndexStyle(1,DRAW_ARROW,0,1,Red);
SetIndexBuffer(0,up);
SetIndexBuffer(1,dn);
SetIndexArrow(0,233);
SetIndexArrow(1,234);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void PutArrow(string name,int code,double p,datetime time,color clr)
{
//--- создадим стрелку
ObjectDelete(0,name);
ObjectCreate(0,name,OBJ_ARROW,0,time,p);
//--- установим код стрелки
ObjectSetInteger(0,name,OBJPROP_ARROWCODE,code);
//--- установим способ привязки
ObjectSetInteger(0,name,OBJPROP_ANCHOR,ANCHOR_CENTER);
//--- установим цвет стрелки
ObjectSetInteger(0,name,OBJPROP_COLOR,clr);
//--- установим размер стрелки
ObjectSetInteger(0,name,OBJPROP_WIDTH,1);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---
if(t!=time[0] )
//if(t!=time[0] && Alerts)
{
for(int i=0;i<BarsCount;i++)
{
double ma=iMA(NULL,0,MAPeriod,0,MAMethod,MAPrice,i);//PRICE_TYPICAL 5
double hi=iFractals(NULL,0,MODE_UPPER,i+fr); //"4"- бар после которого сигнал
double lo=iFractals(NULL,0,MODE_LOWER,i+fr);
if(close[i]>ma && lo>0 )
{
up[i]=low[i];
//Alert(_Symbol+" Buy!");
}
if(close[i]<ma && hi>0)
{
dn[i]=high[i];
// Alert(_Symbol+" Sell!");
}
}
t=time[0];
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
</code>
kasper.by/blog/palitra-web-tsvetov
Исправил
<code> void ModeObjects() { for(int i=ObjectsTotal()-1;i>=0;i--) { if(ObjectType(ObjectName(i))==OBJ_TREND) ObjectSet(ObjectName(i),OBJPROP_TIME2,Time[0]+PeriodSeconds()*BarsCount); if(ObjectType(ObjectName(i))==OBJ_ARROW_RIGHT_PRICE) ObjectSet(ObjectName(i),OBJPROP_TIME1,Time[0]+PeriodSeconds()*BarsCount); } } </code>
вместо
OBJPROP_TIME надо OBJPROP_TIME1 это координата 1-ой точки
cerber04