Скачать MetaTrader 5
Авторизуйтесь или зарегистрируйтесь, чтобы добавить комментарий
Опубликуй торговый сигнал. Получи доступ к миллионам трейдеров!
Forex Trader
114255
Forex Trader 2006.06.02 17:41 
Privet,

Kakto u menia polu4ajetsia situacija, 4to indikator, vyzyvajemyj 4erez iCustom() (MT4 build 193) zagzruzajetsia zanovo na kazdyj tik, pri 4iom tam i init() toze kazdyj raz vyzyvajetsia. Sam indikator imejet vyzov na return() posle pervovo zapuska,prodolzajet rabotat' posle vtorovo i t.d. jesli vstavit priamo v grafik.

Dumaju, 4to eto mozet byt kak i bagom MT4, tak kak jesli uz zagruzili 1 raz indikator v eksperte, ninado kazdyj raz jevo zapuskat' zanovo, pust posle kazdovo vyzova iCustom() on rabotajet kak v normal'nom grafike :)

Kakije budet ideji i reshenija nad etom? Jesli u menia zapuskat' indikator kazdyj raz zanovo, s nevo ni4evo nipolu4ish + kazdyj init() = 2 stroki v loge(na kazdyj tik fludit).

Mozet eto reshyt skazem jesli dobavit special'nuju funkciju iCustomInit() dlia indikatorov v eksperte, a patom prosto s4itat dannyje s indikatora tak kak by etot rabotal priamo v grafike.
MetaQuotes Software Corp.
Модератор
181030
MetaQuotes Software Corp. 2006.06.02 19:02  
Выложите полный код индикатора и полный код эксперта, пожалуйста.
Без кода Вы теряете время - тут программисты и им нужен код, чтобы ответить на вопрос.
Forex Trader
114255
Forex Trader 2006.06.02 19:26  
Ok, paprobuju napisat' primitiv s takoj ze problemoj.
Forex Trader
114255
Forex Trader 2006.06.02 20:08  
Vot kod indikatora i experta dlia debuga problemy:

//+------------------------------------------------------------------+
//|                                              CustomIndicator.mq4 |
//|        Copyright © 2005, Arunas Pranckevicius(T-1000), Lithuania |
//|                                      irc://irc.omnitel.net/forex |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Arunas Pranckevicius(T-1000), Lithuania"
#property link      "irc://irc.omnitel.net/forex"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//---- input parameters
extern int       HighLowPeriod=350;
extern int       Shift=0;
extern double    NoisePipsFactor=0.38197;
extern double    TrendFactor=0.38197;
extern bool      Alerts=false;
extern double    EntryPips=10.0;
extern bool      ShowHistory=true;
extern int       ArrowSize=1;
extern bool      Arrows=true;
#include <WinUser32.mqh>
//---- buffers
double UpTrend[1000];
double DownTrend[1000];
int init=0;
int counter=0;
int counter2=0;
int ShortPeriod=0;
int LongPeriod=0;
int PriceShift=0;
int MaxPriceBar=0;
int MinPriceBar=0;
double MaxPrice=0;
double MinPrice=0;
int MinCount=0;
int MaxCount=0;
int MaxPriceBar2=0;
int MinPriceBar2=0;
double MinPrice2=0;
double MaxPrice2=0;
double WW1=0;
double WW2=0;
double WW3=0;
double WW4=0;
double WW5=0;
double WW6=0;
double WWTargetAngle=0;
double WWTrendAngle=0;
double WWTarget=0;
double WWTrend=0;
int WaveAngle=0;
int WW1Bar=0;
int WW2Bar=0;
int WW3Bar=0;
int WW4Bar=0;
int WW5Bar=0;
int WW6Bar=0;
int WWCount=0;
int WWTrace=0;
double DevPlus;
double DevAverage;
double DevMinus;
double DevPlus2;
double DevAverage2;
double DevMinus2;
double NoisePts=0;
double EntryPts=0;
double CCI=0;
double MA=0;
double TimeDiff;
double PriceDiff;

/*

Rules for Bullish WolfeWave Structure

Please note the odd sequence in counting, as you will see, it is necessary for the inductive analysis.  By starting with a top we are assured of beginning our count on a new wave.  (The reverse would apply for a bearish wave.)

The 2 point is a top.

The 3 point is the bottom of the first decline.

The 1 point is the bottom prior to point 2 (top), that 3 has surpassed.

The 4 point is the top of the rally after point 3.

The 5 point is the bottom after point 4 and is likely to exceed the extended trend line of 1 to 3. This is the entry point for a ride to the EPA line (1 to 4).

Estimated Price at Arrival (EPA) is trend line of 1 to 4 at apex of extended trend line of 1 to 3 and extended trend line of 2 to 4.

Estimated Time of Arrival (ETA) is apex of extended trend line of 1 to 3 and 2 to 4.

*/

#include <stdlib.mqh>

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW,DRAW_ARROW,ArrowSize,Blue);
   SetIndexArrow(0,246);
   SetIndexBuffer(0,UpTrend);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW,DRAW_ARROW,ArrowSize,Red);
   SetIndexArrow(1,248);
   SetIndexBuffer(1,DownTrend);
   SetIndexEmptyValue(1,0.0);
   //double dev=deviance(HighLowPeriod/10,PriceShift);
   //Print("Deviance:", deviance(HighLowPeriod,PriceShift));

if (HighLowPeriod < 2)
{
Print("ERROR: Invalid input parameters, HighLowPeriod() must be 2 or greater, exiting.");
MessageBox("ERROR: Invalid input parameters, HighLowPeriod() must be 2 or greater, exiting.");
return(1);
}

if (init == 0)
{
/*
for counter = PriceShift to HighLowPeriod+1+PriceShift
// Clean all placed own markers in chart
{
DelArrow(Time[counter],High[PriceShift] + NoisePts);
DelArrow(Time[counter],Low[PriceShift] - NoisePts);
}
*/
EntryPts = EntryPips * Point;
Print(Symbol()," CustomIndicator loaded.");
}
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   ObjectsDeleteAll(0,OBJ_ARROW);
   ObjectsDeleteAll(0,OBJ_TREND);
   ObjectsDeleteAll(0,OBJ_FIBO);
   ObjectsDeleteAll(0,OBJ_HLINE);
   ObjectsDeleteAll(0,OBJ_VLINE);
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {      
   if (init == 0)
   {
    init = 1;
   if (Symbol() == "EURUSD") Print ("Return Checkpoint.");
    return(1); // Do not allow exeution if no init
   } 
//----
   return(0);
  }
//+------------------------------------------------------------------+



//+------------------------------------------------------------------+
//|                                           BADiCustom.mq4 |
//|       Copyright © 2005, Arunas Pranckevicius (T-1000), Lithuania |
//|                                            irc://irc.omnitel.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Arunas Pranckevicius (T-1000), Lithuania"
#property link      "irc://irc.omnitel.net"

#include <stdlib.mqh>

extern double TakeProfit = 300;
extern double StopLoss = 100;
extern double Lots = 0.1;
extern double TrailingStop = 35;
extern int HighLowPeriod=350;
extern int Shift=0;
extern double NoisePipsFactor=0.61803;
extern int Alerts=0;
extern double EntryPips=30;
extern int Trades=1;
extern double MinTakeProfit=150;
extern double MinStopLoss=50;
extern double BidStopPoints=70;
extern int DelayedBidsTimeout=36000;
extern double ParabolicSarStep=0.0015;
extern double ParabolicSarMax=0.01;
double Slippage=0;
extern bool Arrows=true;
extern int  ArrowSize=1;
double WW=0;
int counter=0;
double LastWW=0;
int BuyCount=0;
int SellCount=0;
int MyOrderType=0;
int TotalSymbolTrades=0;
double WWPrice=0;
double WWTrend=0;
double WWTarget=0;
int WWBar=0;
int WWNumber=0;
int LastWWNumber=0;
int LastWWNumber2=0;
double CCI=0;
double MA=0;
int CountedBars;
double ShortMA=0;
double BidStopPts=0;
double EntryPts=0;
datetime LastTradeTime=0;
int MAGIC=20050707;



//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//---- 
GlobalVariableSet ( "LastTradeTime",Time[0]-1000);   
//WW=iCustom(Symbol(),0,"WolfeWaves",HighLowPeriod,Shift,NoisePipsFactor,false,EntryPips,false,1,false,0,0);
//WW=WolfeWaves(HighLowPeriod,Shift,NoisePipsFactor,false,EntryPips,false,1,false,1);
Print(Symbol(),"BADiCustom loaded.");
//----
   return(true);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(true);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
int err,trade,op_trade;

//---- 
if (Bars < HighLowPeriod * 2) 
return(true);   

if (Symbol() == "EURUSD") Print ("Expert Checkpoint.");

WW=iCustom(Symbol(),0,"CustomIndicator",HighLowPeriod,Shift,NoisePipsFactor,false,20,false,1,true,0);
if (Symbol() == "EURUSD") Print ("Expert Checkpoint #2.");
//----
   return(true);
  }
//+------------------------------------------------------------------+
Forex Trader
114255
Forex Trader 2006.06.02 20:53  
v vyzove nixvatajet parametrov:

WW=iCustom(Symbol(),0,"CustomIndicator",HighLowPeriod,Shift,NoisePipsFactor,false,20,false,1,true,0);

No daze jesli polnostju zapolnena parametry mode i shift vsio ravno takaja ze samaja situacija.
Forex Trader
114255
Forex Trader 2006.06.02 20:54  

extern int HighLowPeriod=350;
extern int Shift=0;
extern double NoisePipsFactor=0.38197;
extern double TrendFactor=0.38197;
extern bool Alerts=false;
extern double EntryPips=10.0;
extern bool ShowHistory=true;
extern int ArrowSize=1;
extern bool Arrows=true;


WW=iCustom(Symbol(),0,"CustomIndicator",HighLowPeriod,Shift,NoisePipsFactor,false,20,false,1,true,0);


По всей видимости, неверный порядок аргументов TrendFactor и Alerts. Сам на такое нарывался.
Forex Trader
114255
Forex Trader 2006.06.02 21:15  
Обычно делаю так:

/*
//---- параметры индикатора ----
extern int Range = 9;
extern double Alpha = 0.0;
extern double Betta = 0.0;
extern double Gamma = 0.0;
extern double Relax = 0.1;
extern double ER_Low = 0.06;
extern double ER_Upp = 0.66;
extern double P_G = 2.0;
extern double K_F = 2.5;
extern bool LastBarOnly = false;
*/
// вызов индикатора
signalAS_prev = signalAS_curr;
signalAS_curr = iCustom(NULL, 0, WrkIndName1, Range, Alpha, Betta, Gamma,
Relax, ER_Low, ER_Upp, P_G, K_F, LastBarOnly, 0, 1);

Тогда меньше вероятность ошибиться при вызове iCustom(...) с большим числом параметров.
Forex Trader
114255
Forex Trader 2006.06.02 21:20  
Pomenial na

WW=iCustom(Symbol(),0,"CustomIndicator",HighLowPeriod,Shift,NoisePipsFactor,0,false,20,false,1,true,0,0);

Zarabotalo :)

Kstate, vidimo sdies' nuzna proverka v MT4 na parametry i ix tipy, peredavajemyje 4erez iCustom() funkciju.
Forex Trader
114255
Forex Trader 2006.06.02 21:32  
Поддерживаю.
/
Авторизуйтесь или зарегистрируйтесь, чтобы добавить комментарий