简体   繁体   English

在出现在图MQL5上之前预测分形

[英]predicting fractal before appearing on graph MQL5

I am trying to predict the fractal values before they appear on the chart so that I can apply other algorithms. 我试图在分形值出现在图表上之前对其进行预测,以便我可以应用其他算法。 I have tried the following but is of no use as it is giving the false positive to me.: 我尝试了以下操作,但没有用,因为它给了我误报。:

int fractalStore;
int OnInit()
{
   fractalStore = iFractals( _Symbol, _Period );
   ArraySetAsSeries( UpFrac,  false );
   ArraySetAsSeries( DownFrac,false );

   return( INIT_SUCCEEDED );
}

void OnTick()
{
     CopyBuffer( fractalStore, 0, 0, 5, UpFrac   );
     CopyBuffer( fractalStore, 1, 0, 5, DownFrac );

     if (  ( UpFrac[  0] != UpFrac[  1] )
        && ( DownFrac[0] == DownFrac[1] )
        && ( UpFrac[  0] == DownFrac[1] )
        && ( UpFrac[  0] == DownFrac[0] )
           )
     {
         trade.Buy( 0.1 );
         if ( !ArrowBuyCreate( 0, "Arrow Buy" + IntegerToString( count ) ) )
               Print( "Cannot sell" );              
     }

     if (  ( DownFrac[0] != DownFrac[1] )
        && ( UpFrac[  0] == UpFrac[  1] )
        && ( UpFrac[  1] == DownFrac[0] )
        && ( UpFrac[  0] == DownFrac[0] )
           )
     {
           trade.Sell( 0.1 );
           ArrowUpCreate();

           if (  !ArrowSellCreate( 0, "Arrow Sell" + IntegerToString( count ) ) )
                  Print( "Cannot sell" );

           Comment( "Sell" );
       }
}

bool ArrowSellCreate(const long            chart_ID=0,        // chart's ID 
                     const string          name="ArrowSell",  // sign name 
                     const int             sub_window=0,      // subwindow index 
                     datetime              time=0,            // anchor point time 
                     double                price=0,           // anchor point price 
                     const color           clr=C'225,68,29',  // sign color 
                     const ENUM_LINE_STYLE style=STYLE_SOLID, // line style (when highlighted) 
                     const int             width=1,           // line size (when highlighted) 
                     const bool            back=false,        // in the background 
                     const bool            selection=false,   // highlight to move 
                     const bool            hidden=true,       // hidden in the object list 
                     const long            z_order=0)         // priority for mouse click 
  { 
//--- set anchor point coordinates if they are not set 
   ChangeArrowEmptyPoint(time,price); 
//--- reset the error value 
   ResetLastError(); 
//--- create the sign 
   if(!ObjectCreate(chart_ID,name,OBJ_ARROW_SELL,sub_window,time,price)) 
     { 
      Print(__FUNCTION__, 
            ": failed to create \"Sell\" sign! Error code = ",GetLastError()); 
      return(false); 
     } 
//--- set a sign color 
   ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr); 
//--- set a line style (when highlighted) 
   ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style); 
//--- set a line size (when highlighted) 
   ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width); 
//--- display in the foreground (false) or background (true) 
   ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back); 
//--- enable (true) or disable (false) the mode of moving the sign by mouse 
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection); 
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection); 
//--- hide (true) or display (false) graphical object name in the object list 
   ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden); 
//--- set the priority for receiving the event of a mouse click in the chart 
   ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order); 
//--- successful execution 
   return(true); 
  } 
//+------------------------------------------------------------------+ 
//| Move the anchor point                                            | 
//+------------------------------------------------------------------+ 
bool ArrowSellMove(const long   chart_ID=0,       // chart's ID 
                   const string name="ArrowSell", // object name 
                   datetime     time=0,           // anchor point time coordinate 
                   double       price=0)          // anchor point price coordinate 
  { 
//--- if point position is not set, move it to the current bar having Bid price 
   if(!time) 
      time=TimeCurrent(); 
   if(!price) 
      price=SymbolInfoDouble(Symbol(),SYMBOL_BID); 
//--- reset the error value 
   ResetLastError(); 
//--- move the anchor point 
   if(!ObjectMove(chart_ID,name,0,time,price)) 
     { 
      Print(__FUNCTION__, 
            ": failed to move the anchor point! Error code = ",GetLastError()); 
      return(false); 
     } 
//--- successful execution 
   return(true); 
  } 
//+------------------------------------------------------------------+ 
//| Delete Sell sign                                                 | 
//+------------------------------------------------------------------+ 
bool ArrowSellDelete(const long   chart_ID=0,       // chart's ID 
                     const string name="ArrowSell") // sign name 
  { 
//--- reset the error value 
   ResetLastError(); 
//--- delete the sign 
   if(!ObjectDelete(chart_ID,name)) 
     { 
      Print(__FUNCTION__, 
            ": failed to delete \"Sell\" sign! Error code = ",GetLastError()); 
      return(false); 
     } 
//--- successful execution 
   return(true); 
  } 
//+------------------------------------------------------------------+ 
//| Check anchor point values and set default values                 | 
//| for empty ones                                                   | 
//+------------------------------------------------------------------+ 
void ChangeArrowEmptyPoint(datetime &time,double &price) 
  { 
//--- if the point's time is not set, it will be on the current bar 
   if(!time) 
      time=TimeCurrent(); 
//--- if the point's price is not set, it will have Bid value 
   if(!price) 
      price=SymbolInfoDouble(Symbol(),SYMBOL_BID); 
  } 
bool ArrowBuyCreate(const long            chart_ID=0,        // chart's ID 
                    const string          name="ArrowBuy",   // sign name 
                    const int             sub_window=0,      // subwindow index 
                    datetime              time=0,            // anchor point time 
                    double                price=0,           // anchor point price 
                    const color           clr=C'3,95,172',   // sign color 
                    const ENUM_LINE_STYLE style=STYLE_SOLID, // line style (when highlighted) 
                    const int             width=1,           // line size (when highlighted) 
                    const bool            back=false,        // in the background 
                    const bool            selection=false,   // highlight to move 
                    const bool            hidden=true,       // hidden in the object list 
                    const long            z_order=0)         // priority for mouse click 
  { 
//--- set anchor point coordinates if they are not set 
   ChangeArrowEmptyPoint(time,price); 
//--- reset the error value 
   ResetLastError(); 
//--- create the sign 
   if(!ObjectCreate(chart_ID,name,OBJ_ARROW_BUY,sub_window,time,price)) 
     { 
      Print(__FUNCTION__, 
            ": failed to create \"Buy\" sign! Error code = ",GetLastError()); 
      return(false); 
     } 
//--- set a sign color 
   ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr); 
//--- set a line style (when highlighted) 
   ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style); 
//--- set a line size (when highlighted) 
   ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width); 
//--- display in the foreground (false) or background (true) 
   ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back); 
//--- enable (true) or disable (false) the mode of moving the sign by mouse 
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection); 
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection); 
//--- hide (true) or display (false) graphical object name in the object list 
   ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden); 
//--- set the priority for receiving the event of a mouse click in the chart 
   ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order); 
//--- successful execution 
   return(true); 
  } 
//+------------------------------------------------------------------+ 
//| Move the anchor point                                            | 
//+------------------------------------------------------------------+ 
bool ArrowBuyMove(const long   chart_ID=0,      // chart's ID 
                  const string name="ArrowBuy", // object name 
                  datetime     time=0,          // anchor point time coordinate 
                  double       price=0)         // anchor point price coordinate 
  { 
//--- if point position is not set, move it to the current bar having Bid price 
   if(!time) 
      time=TimeCurrent(); 
   if(!price) 
      price=SymbolInfoDouble(Symbol(),SYMBOL_BID); 
//--- reset the error value 
   ResetLastError(); 
//--- move the anchor point 
   if(!ObjectMove(chart_ID,name,0,time,price)) 
     { 
      Print(__FUNCTION__, 
            ": failed to move the anchor point! Error code = ",GetLastError()); 
      return(false); 
     } 
//--- successful execution 
   return(true); 
  }

I am trying to predict the values of Fractal arrows and display them. 我试图预测分形箭头的值并显示它们。 But getting very different values and placing the arrows else where. 但是获得非常不同的值并将箭头放置在其他位置。

Kindly, help me and let me know how I can predict the arrows of the fractal before actual indicator placing the arrow. 请帮助我,让我知道在实际指标放置箭头之前如何预测分形的箭头。

One who has read a definition of Fractal knows this will never fly 阅读过Fractal定义的人知道这永远不会飞

By design, there is at least a 3 Bar principal detection lag, before one can confirm a presence of Fractal-based signal. 通过设计,在可以确认基于分形的信号存在之前,至少有3 Bar的主要检测滞后。

As simple as this. 就这么简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM