코딩 도움말 - 페이지 693

 
mladen :

레이

지금 사용해 보세요

믈라덴

여전히 변화가 없습니다. 다시 시도해 볼까요?

이것이 내가 2MA를 위해 한 모든 것입니다.

이중 fastMA = iMA(NULL,0,FastMa,FastMaShift,FastMaMethod,FastMaPrice,i);
이중 slowMA = iMA(NULL,0,SlowMa,SlowMaShift,SlowMaMethod,SlowMaPrice,i);

UpH[i] = EMPTY_VALUE ;
DnH[i] = EMPTY_VALUE;
추세[i] = 추세[i+1];

이중 확산 = (fastMA - slowMA);

이중 diffd = (slowMA - fastMA);

if (diffu > diff_Level ) 경향[i] = 1;
if (diffd > diff_Level ) 경향[i] = -1;


감사해요

레이

 
traderduke :

믈라덴

여전히 변화가 없습니다. 다시 시도해 볼까요?

이것이 내가 2MA를 위해 한 모든 것입니다.

이중 fastMA = iMA(NULL,0,FastMa,FastMaShift,FastMaMethod,FastMaPrice,i);
이중 slowMA = iMA(NULL,0,SlowMa,SlowMaShift,SlowMaMethod,SlowMaPrice,i);

UpH[i] = EMPTY_VALUE;
DnH[i] = EMPTY_VALUE;
추세[i] = 추세[i+1];

이중 확산 = (fastMA - slowMA);

이중 diffd = (slowMA - fastMA);

if (diffu > diff_Level ) 경향[i] = 1;
if (diffd > diff_Level ) 경향[i] = -1;


감사해요

레이

이것은 다중 시간 프레임 모드를 시도할 때 얻는 것입니다(위 게시물의 표시기).


내가 보는 모든 것이 제대로 작동합니다.

 
mladen :

이것은 다중 시간 프레임 모드를 시도할 때 얻는 것입니다(위 게시물의 표시기).

주의: 동영상을 다시 업로드해야 합니다.

주의: 동영상을 다시 업로드해야 합니다.
내가 보는 한, 모든 것이 작동해야 하는 대로 작동합니다.

믈라덴

제 문제를 명확하게 제시하지 못한 점에 대해 사과드립니다. diff_Levelms 0.0이 제대로 작동하지만 diff_Levelms를 추가한 것은 EURUSD의 경우 .0002 또는 USDJPY의 경우 .02와 같이 범위와 같은 사소한 변경을 허용하기 위한 것입니다. 분명히 내 diff 계산은 trend1 계산에서 사용되지 않습니다

이중 확산 = (ma2[i]-ma3[i]); //med-slow 분명히 내 계산
이중 diffdms = (ma3[i]-ma2[i]); //slow - med 분명히 내 계산

if (ma1[i]>ma2[i]) trendfm[i] = 1 ;
if (ma1[i]<ma2[i]) trendfm[i] = - 1 ;
if (ma1[i]>ma3[i]) trendfs[i] = 1 ;
if (ma1[i]<ma3[i]) trendfs[i] = - 1 ;
if (ma2[i]>ma3[i] && diffums > diff_Levelms) trendms[i] = 1 ; trend1 계산에 사용되지 않음
if (ma2[i]<ma3[i] && diffdms > diff_Levelms) trendms[i] = - 1 ; trend1 계산에 사용되지 않음


고맙습니다

레이


 

표시기가 업데이트되지 않음


첨부된 "Outsidebar Trendline V2" 표시기를 다운로드했지만 어떤 이유로 업데이트되지 않습니다.

다음 바/촛불. 시간 프레임을 전환하면 잘 작동하지만 해당 시간 프레임의 다음 막대에서는 더 이상 작동하지 않습니다.

다음 막대에서도 표시기가 자동으로 새로 고쳐지도록 전문가가 도와주시겠습니까?

정말 감사합니다

넓은 땅

파일:
[삭제]  

믈라덴,

내 친구가 정점 표시기를 기반으로 이 EA를 작성했는데 그가 만든 후 백테스트 를 실행할 수 없었습니다. 등받이가 안 되는 오류를 수정하도록 도와주세요. 하지만 한 번 청소하면 많은 업데이트가 필요합니다.

감사하고 겸손하게

// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
#include <stdlib.mqh>
#include <stderror.mqh> 



#property copyright "reddevil"
#property link ""
#property version "3.0" ;
// 19-09 minimum of 4 periods before the next order.
// v1.2 check alternate timeframe for spike
// v2.0 uses 3.01a indicator with alternate timeframe
//v3.0 red crossing blue as entry
// trailing after line cross
// ------------------------------------------------------------------------------------------------
// VARIABLES EXTERNAS
// ------------------------------------------------------------------------------------------------
//
// check for candle 

extern int magic = 668899 ;
 string progName= "VertexPro3" ;
 string key = "vertex 3.0" ;
// Configuration

extern string CommonSettings = "---------------------------------------------" ;
extern int user_slippage = 2 ; 
extern double max_spread = 3.0 ;
extern int user_tp = 0 ; // min TP
extern int user_sl = 50 ; // max SL
//extern int AlternateTF = 30 ; // 30 mins
extern double Entry_line = 10 ; // 10 sell, -10 buy
// extern double Entry_pips = 10; // from highest high or lowest low
extern string TakeProfit_trigger = "------------------------------------------" ;
extern int TPdefault_line = 25 ;
extern double BBvalue1 = 10.0 ;
extern int BBTP_line = 15 ;

//extern bool DailyFilter=true;
extern bool NewsFilter= false ;
extern int MinsBeforeNews= 1440 ;
extern int MinsAfterNews= 60 ;
extern int maxOrders= 3 ; //max 3
extern string Trailing = "----------------------------------------------------" ;
extern int UseTrailing= 2 ; // 0 - no trailing, 1- normal; 2-trail after TP line

extern int TrailStartPips= 8 ;
extern int Trailpips= 5 ;
extern int TrailStepPips= 3 ;
extern string MoneyManagementSettings = "---------------------------------------------" ;
// Money Management
extern bool money_management = false ;
extern double min_lots = 0.1 ;
extern int risk= 1 ;
extern int progression = 0 ; // 0=none | 1:ascending | 2:martingale


extern int GMToffset= 2 ;
int arrLgt= 3 ;
int buy_magic[ 3 ];
int sell_magic[ 3 ];
int buy_tickets[ 3 ];
int sell_tickets[ 3 ];
// Lots
double buy_lots[ 3 ];
double sell_lots[ 3 ];
// Current Profit
double buy_profit[ 3 ];
double sell_profit[ 3 ];
//SL
double sell_sl[ 3 ];
double buy_sl[ 3 ];
//TP
double sell_tp[ 3 ];
double buy_tp[ 3 ];
// Open Price
double buy_price[ 3 ];
double sell_price[ 3 ];

datetime buy_time; // last buytime
datetime sell_time;
// Indicator
double rsi= 0 ;
// Number of orders
int buys = 0 ;
int sells = 0 ;
double total_buy_profit= 0 ,total_sell_profit= 0 ;
double total_buy_lots= 0 , total_sell_lots= 0 ;
double buy_max_profit= 0 , buy_close_profit= 0 ;
double sell_max_profit= 0 , sell_close_profit= 0 ;
// Indicator


// ------------------------------------------------------------------------------------------------
// VARIABLES GLOBALES
// ------------------------------------------------------------------------------------------------



// indicadores

// Cantidad de ordenes;
int orders = 0 ;
int direction= 0 ;
double max_profit= 0 , close_profit= 0 ;
double last_order_profit= 0 , last_order_lots= 0 ;
// Colores
color c=Black;
// Cuenta
double balance, equity;
int slippage= 0 ;
// OrderReliable




int OldHist= 0 ;
double SL,PT,_spread;
int newMagic1,newMagic2;
int curMagic;
int Tframe = PERIOD_H1 ;
datetime   OldTime;
int _DSTtime= 0 ;
int pendingTicket=- 1 ;
bool NoNews= true ;
int mBefore, mAfter;

// ------------------------------------------------------------------------------------------------
// START
//
void init()
{
     if ( Digits == 4 || Digits == 2 )
  {
    slippage = user_slippage;
    PT= Point ;
  }
   else if ( Digits == 5 || Digits == 3 )
  {
      slippage = 10 *user_slippage;
      PT= Point * 10 ;
  }
  
        
 
   if (maxOrders > 3 )  maxOrders= 3 ;
  
      
  newMagic1 = StrToInteger ( IntegerToString (TPdefault_line) + IntegerToString (magic));
  newMagic2 = StrToInteger ( IntegerToString (BBTP_line) + IntegerToString (magic)); 
}
int start()
{  
   double point = MarketInfo ( Symbol (), MODE_POINT );
   double dd= 0 ;
  
   string DST = "Yes" ;
  
   bool   encontrada;
  balance= AccountBalance ();
  equity= AccountEquity ();
  
   if ( TimeCurrent () - OldTime > 25 )
      {
         RefreshRates ();
         OldTime= TimeCurrent ();
      }

  _spread =   NormalizeDouble ( MathAbs ( Ask - Bid )/PT, 2 );
  
   if ( IsTradeAllowed () == false ) 
  {
     Comment ( "nTrade not allowed." );
     return ( 0 );  
  }
   /*if(StringLen(DoubleToStr(TPdefault_line)) > 3 || StringLen(DoubleToStr(BBTP_line)) > 3)
  {
       Comment("nTPdefault or BBTP too long");
       return(1);
  } */
   if (BBTP_line > TPdefault_line)
   {
       Comment ( "nBBTP must be less than TPdefault" );
       return ( 1 );
   }
   /*if(!IsTesting())
   if (Period() != Tframe) 
   {
      Comment("\n ERROR :: Invalid Timeframe, Please Switch to "+ IntegerToString(Tframe));
      return(0);
   } */
   if ( TimeDaylightSavings ()== 0 )
    {
      DST= "No" ;
    }
   else _DSTtime= 1 ;
   if (! IsTesting ())
   {
     
       //Comment(StringConcatenate("\nLSMA02a is running.\nNext order lots: ",CalcularVolumen(),"\nTake profit ($): ",CalcularVolumen()*10*user_tp,"\nStop loss ($): ",CalcularVolumen()*10*user_sl,"\nSpread: ",_spread, "\nDST: ",DST));
         Comment ( StringConcatenate ( "\n" ,progName, " is running.\nNext order lots: " ,CalcularVolumen(),
           
             "\nTake profit ($): " ,CalcularVolumen()* 10 *user_tp,
             "\nStop loss ($): " ,CalcularVolumen()* 10 *user_sl,
             "\nSpread: " ,_spread, 
             "\nDST: " ,DST,
             "\nMax Orders: " ,maxOrders,
           // "\nDailyFilter ",DailyFilter,
             "\nNewsFilter: " ,NewsFilter,
             "\nMins Before News: " ,mBefore,
             "\nMins After News: " ,mAfter));
          
  }
   // Actualizamos el estado actual
  InitBuy();
  InitSell();
  UpdateVars();
 
  
  encontrada= FALSE ;
  
  
  point = Point ;

  Robot();
  
   return ( 0 );
}
void InitBuy()
{
   // Reset number of buy/sell orders
  buys= 0 ;
  
   // Reset arrays
   for ( int i= 0 ; i<arrLgt; i++)
  {
    buy_tickets[i] = 0 ;
    buy_lots[i] = 0 ;
    buy_profit[i] = 0 ;
    buy_price[i] = 0 ;
    buy_sl[i]= 0 ;
    buy_tp[i]= 0 ;
    buy_magic[i]= 0 ;
    
   
      
  }
}
void InitSell()
{
   // Reset number of buy/sell orders
 
  sells= 0 ;
   // Reset arrays
   for ( int i= 0 ; i<arrLgt; i++)
  {
   
    sell_tickets[i] = 0 ;
    sell_lots[i] = 0 ;
    sell_profit[i] = 0 ;
    sell_price[i] = 0 ;
    sell_sl[i]= 0 ;
    sell_tp[i]= 0 ;
    sell_magic[i]= 0 ;
      
  }
}
void UpdateVars()
{
   int aux_buys= 0 , aux_sells= 0 ;
   double aux_total_buy_profit= 0 , aux_total_sell_profit= 0 ;
   double aux_total_buy_lots= 0 , aux_total_sell_lots= 0 ;
  buy_time= 0 ;
  sell_time= 0 ;
   datetime oTime;
   // We are going to introduce data from opened orders in arrays  
   for ( int i= 0 ; i< OrdersTotal (); i++)
  {
     if ( OrderSelect (i, SELECT_BY_POS , MODE_TRADES ) == true )
     if ( OrderSymbol () == Symbol () && ( OrderMagicNumber () == newMagic1 || OrderMagicNumber () == newMagic2)   )
      {
         if ( OrderType () == OP_BUY )
         {
           buy_tickets[aux_buys] = OrderTicket ();
           buy_lots[aux_buys] = OrderLots ();
           buy_profit[aux_buys] = OrderProfit ()+ OrderCommission ()+ OrderSwap ();
           buy_price[aux_buys] = OrderOpenPrice ();
           buy_sl[aux_buys] = OrderStopLoss ();
           buy_tp[aux_buys] = OrderTakeProfit ();
           aux_total_buy_profit = aux_total_buy_profit + buy_profit[aux_buys];
           aux_total_buy_lots = aux_total_buy_lots + OrderLots ();
           oTime = OrderOpenTime ();
           buy_magic[aux_buys]= OrderMagicNumber ();
           if (oTime > buy_time)
               buy_time = oTime;
           
            aux_buys++;
         }
         else if ( OrderType () == OP_SELL )
         {
           sell_tickets[aux_sells] = OrderTicket ();
           sell_lots[aux_sells] = OrderLots ();
           sell_profit[aux_sells] = OrderProfit ()+ OrderCommission ()+ OrderSwap ();
           sell_price[aux_sells] = OrderOpenPrice ();
           sell_sl[aux_sells] = OrderStopLoss ();
           sell_tp[aux_sells] = OrderTakeProfit ();
           aux_total_sell_profit = aux_total_sell_profit + sell_profit[aux_sells];
           aux_total_sell_lots = aux_total_sell_lots + OrderLots ();
            oTime = OrderOpenTime ();
            sell_magic[aux_sells]= OrderMagicNumber ();
             if (oTime > sell_time)
               sell_time = oTime;
           aux_sells++;
         }
    }
  }
  
   // Update global vars
  buys = aux_buys;
  sells = aux_sells;
  total_buy_profit = aux_total_buy_profit;
  total_sell_profit = aux_total_sell_profit;
  total_buy_lots = aux_total_buy_lots;
  total_sell_lots = aux_total_sell_lots;
}


[삭제]  

그리고 이것은 계속

 // ------------------------------------------------------------------------------------------------
// INICIALIZAR VARIABLES
// ------------------------------------------------------------------------------------------------


// ------------------------------------------------------------------------------------------------
// ACTUALIZAR ORDENES
// ------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------
// CALCULAR VOLUMEN
// ------------------------------------------------------------------------------------------------
double CalcularVolumen()
{ 
   double aux= 0 ; 
   int n;
  
   if (money_management== 0 )
  {
    aux=min_lots;
  }
   else
  {    
     if (progression== 0 ) 
    { 
      aux = risk* AccountFreeMargin ();
      aux= aux/ 100000 ;
      n = ( int ) MathFloor (aux/min_lots);
      
      aux = n*min_lots;                   
    }  
  
     if (progression== 1 )
    {
       if (last_order_profit< 0 )
      {
        aux = last_order_lots+min_lots;
      }
       else 
      {
        aux = last_order_lots-min_lots;
      }  
    }        
    
     if (progression== 2 )
    {
       if (last_order_profit< 0 )
      {
        aux = last_order_lots* 2 ;
      }
       else 
      {
         aux = risk* AccountFreeMargin ();
         aux= aux/ 100000 ;
         n = ( int ) MathFloor (aux/min_lots);
         
         aux = n*min_lots;         
      }  
    }     
    
     if (aux<min_lots)
        aux=min_lots;
     
     if (aux> MarketInfo ( Symbol (), MODE_MAXLOT ))
      aux= MarketInfo ( Symbol (), MODE_MAXLOT );
      
     if (aux< MarketInfo ( Symbol (), MODE_MINLOT ))
      aux= MarketInfo ( Symbol (), MODE_MINLOT );
  }
  
   return (aux);
}

// ------------------------------------------------------------------------------------------------
// CALCULA VALOR PIP
// ------------------------------------------------------------------------------------------------
double CalculaValorPip( double lotes)
{ 
   double aux_mm_valor= 0 ;
   
   double aux_mm_tick_value = MarketInfo ( Symbol (), MODE_TICKVALUE );
   double aux_mm_tick_size = MarketInfo ( Symbol (), MODE_TICKSIZE );
   int aux_mm_digits = ( int ) Digits ;   
   double aux_mm_veces_lots = 1 /lotes;
      
   if (aux_mm_digits== 5 )
   {
     aux_mm_valor=aux_mm_tick_value* 10 ;
   }
   else if (aux_mm_digits== 4 )
   {
     aux_mm_valor = aux_mm_tick_value;
   }
   
   if (aux_mm_digits== 3 )
   {
     aux_mm_valor=aux_mm_tick_value* 10 ;
   }
   else if (aux_mm_digits== 2 )
   {
     aux_mm_valor = aux_mm_tick_value;
   }
   
   aux_mm_valor = aux_mm_valor/aux_mm_veces_lots;
   
   return (aux_mm_valor);
}


// ------------------------------------------------------------------------------------------------
// CALCULA SIGNAL
// ------------------------------------------------------------------------------------------------


int CalculaSignal()
{
   int aux= 0 ;
 
   if ( MathAbs ( Bid - Ask )/PT > max_spread)
       return (aux);
   double v1 = iCustom ( NULL , 0 , "vertex_mod_3.01" , 0 , 1 );
   double v2 = iCustom ( NULL , 0 , "vertex_mod_3.01" , 0 , 2 );
   double v3 = iCustom ( NULL , 0 , "vertex_mod_3.01" , 0 , 3 );
   double v4 = iCustom ( NULL , 0 , "vertex_mod_3.01" , 0 , 4 );
   double b1 = iCustom ( NULL , 0 , "vertex_mod_3.01" , 1 , 1 );
   double b2 = iCustom ( NULL , 0 , "vertex_mod_3.01" , 1 , 2 );
  
      
   
   double bb;
   int stCount= 0 ;
  
  
   if (v2 > Entry_line && v2 > b2 && v1 < b1)
   {
      stCount= 2 ;
   
   }
   else if (v3 > Entry_line && (  v2 > b2 && v1 < b1) )
      {
      stCount= 3 ;
      
    }
 
   else if (v4 > Entry_line && (  v2 > b2 && v1 < b1) )
      stCount= 4 ;  
   if (stCount > 0 )
  {
     
         
               aux= 2 ;
              
               bb = iCustom ( NULL , 0 , "vertex_mod_3.01" , 2 ,stCount);
               if (bb > BBvalue1)
                  curMagic=newMagic2;
               else
                  curMagic=newMagic1;
               
            
      
  }
   else
  {
     
     if (v2 < Entry_line*(- 1 ) &&  v2 < b2 && v1 > b1)
       {
         stCount= 2 ;
         
       }
     else if (v3 < Entry_line*(- 1 ) &&  v2 < b2 && v1 > b1)
       {
         stCount= 3 ;
       }
     else if (v4 < Entry_line*(- 1 ) &&  v2 < b2 && v1 > b1)
         stCount= 4 ; 
         
         
     if (stCount > 0 )
      {
             
                  
              aux= 1 ;
              
               bb = iCustom ( NULL , 0 , "vertex_mod_3.01" , 3 ,stCount);
               if (bb < BBvalue1 *(- 1 ))
                  curMagic=newMagic2;
               else
                  curMagic=newMagic1;
           
                 
         
       }
   }
    
   
     
   
   return (aux);  
}

// ------------------------------------------------------------------------------------------------
// ROBOT
// ------------------------------------------------------------------------------------------------

void Robot()
{
   int ticket=- 1 ;
   int signal= 0 ;
   double newSL= 0 ;
   double newTP= 0 ;
   int tpvalue;
   double v1,v2;
   bool clOrder= false ;
   bool setTrail= false ;
 
   int i;
  

 
 
             if (NoNews || NewsFilter== False )
            {
                   ObjectDelete ( "NFP" );
                  
                  signal = CalculaSignal();
             }
             else
            {
                     ObjectCreate ( "NFP" , OBJ_LABEL , 0 , 0 , 0 , 0 , 0 );      
                     ObjectSet ( "NFP" , OBJPROP_CORNER , 2 );      
                     ObjectSet ( "NFP" , OBJPROP_YDISTANCE , 45 );      
                     ObjectSet ( "NFP" , OBJPROP_XDISTANCE , 10 );      
                     ObjectSetText ( "NFP" , "NO trade News time" , 20 , "Tahoma" , Red); 
            }
    
   
     if (signal== 1 && buys < maxOrders)
          
    {
           
           if (user_tp > 0 )
               newTP = NormalizeDouble ( Ask + user_tp*PT, Digits );
          
             SL = NormalizeDouble ( Ask - (user_sl*PT), Digits );
             ticket = OrderSend ( Symbol (), OP_BUY ,CalcularVolumen(), Ask ,slippage,SL,newTP,key,curMagic, 0 ,Blue);
       
    }
    
     if (signal== 2 && sells < maxOrders)
      {
             
         
           if (user_tp> 0 )
             newTP = NormalizeDouble ( Bid - user_tp*PT, Digits );
          
            SL = NormalizeDouble ( Bid + (user_sl*PT), Digits );
            ticket = OrderSend ( Symbol (), OP_SELL ,CalcularVolumen(), Bid ,slippage,SL,newTP,key,curMagic, 0 ,Red);
       
               
      
      } 
      
      
      v2 = iCustom ( NULL , 0 , "vertex_mod_3.01" , 0 , 1 );
       if (buys > 0   )
      {
         if (v2 > Entry_line )
         {
            CloseOrder( OP_BUY );
         }
         else
          {
             if (UseTrailing == 2 || UseTrailing== 0 )
             {
                v1 = iCustom ( NULL , 0 , "vertex_mod_3.01" , 3 , 1 );
                 if (v1 > (- 1 )*TPdefault_line/ 10 || v1 > (- 1 )*BBTP_line/ 10 )
                 {
                     setTrail= false ;
                     for (i= 0 ;i<buys;i++)
                      {
                        clOrder= false ;
                        tpvalue = StringToInteger ( StringSubstr (buy_magic[i], 0 , 2 ));
                         if (tpvalue == BBTP_line && v1 > (- 1 )* BBTP_line/ 10 )
                           clOrder= true ;
                         else if (tpvalue == TPdefault_line && v1 > (- 1 )* TPdefault_line/ 10 )
                            clOrder= true ;
                            
                         if (clOrder)
                         {
                           if (UseTrailing== 0 )
                           ticket = OrderClose (buy_tickets[i],buy_lots[i], Bid ,user_slippage, clrBlue );
                           else
                           {
                              trailProc( OP_BUY ,i);
                           }
                         }
                       }
                 }
             }      
               if (UseTrailing== 1 )
               {
                   for ( i= 0 ; i< buys; i++)
                  {
                    trailProc( OP_BUY ,i);
                  }
                  
               }
          }
      }
     else if (sells > 0 )
     {
   
         if (v2 < Entry_line*(- 1 ))
         {
            CloseOrder( OP_SELL );
         }
       else
       {
           
           if (UseTrailing == 2 || UseTrailing== 0 )
            {  
             v1 = iCustom ( NULL , 0 , "vertex_mod_3.01" , 2 , 1 );
                 if (v1 < TPdefault_line/ 10 || v1 < BBTP_line/ 10 )
                 {
                     setTrail= false ;
                     for (i= 0 ;i<sells;i++)
                      {
                        clOrder= false ;
                        tpvalue = StringToInteger ( StringSubstr (sell_magic[i], 0 , 2 ));
                         if (tpvalue == BBTP_line && v1 < BBTP_line/ 10 )
                           clOrder= true ;
                         else if (tpvalue == TPdefault_line && v1 < TPdefault_line/ 10 )
                            clOrder= true ;
                            
                         if (clOrder)
                        {
                           if (UseTrailing== 0 )
                           ticket = OrderClose (sell_tickets[i],sell_lots[i], Bid ,user_slippage, clrRed );
                           else
                          {
                              trailProc( OP_SELL ,i);
                          
                          }
                        
                       }
                      }
                } 
             }
               if (UseTrailing == 1 ) 
              { 
                   for ( i= 0 ; i< sells; i++)
                  {
                    trailProc( OP_SELL ,i);
                  }
              }
         }
      }
            
        
             
        
  }
  
   void trailProc( int _type, int i)
  {
   double newSL= 0 ;
   int ticket;
   if (_type == OP_BUY )
    {
                   newSL= 0 ;
                     if ( Bid - buy_price[i] > TrailStartPips*PT)
                    {
                     if ( Bid - buy_sl[i] > (Trailpips + TrailStepPips)*PT && buy_sl[i] > buy_price[i])
                      {
                        newSL = NormalizeDouble ( Bid - Trailpips*PT, Digits );
                      }
                     else if (buy_sl[i] < buy_price[i])
                      {
                        newSL = NormalizeDouble ( Bid - Trailpips*PT, Digits );
                      }
                      
                       if (newSL > 0 && newSL > buy_sl[i])
                        ticket = OrderModify (buy_tickets[i],buy_price[i],newSL,buy_tp[i], 0 , clrBlue );
                   }
    }
   else
    {
                  newSL= 0 ;
                     if ( sell_price[i] - Ask > TrailStartPips*PT)
                    {
                     if ( sell_sl[i] - Ask > (Trailpips + TrailStepPips)*PT && sell_sl[i] > sell_price[i])
                      {
                        newSL = NormalizeDouble ( Ask + Trailpips*PT, Digits );
                      }
                     else if (sell_sl[i] < sell_price[i])
                      {
                        newSL = NormalizeDouble ( Ask + Trailpips*PT, Digits );
                      }
                      
                       if (newSL > 0 && newSL < sell_sl[i])
                        ticket = OrderModify (sell_tickets[i],sell_price[i],newSL,sell_tp[i], 0 , clrBlue );
                    }
    
    
    } 
  
  }
   void CloseOrder( int _type)
  {
     int resp;
     int i;
       if (_type== OP_BUY )
      {
         for ( i= 0 ; i< buys; i++)
         {
         
            resp= OrderClose (buy_tickets[i],buy_lots[i], Bid , 2 , clrBlue );
         }
         InitBuy();
         
      }
     else    if (_type== OP_SELL )
      {
         for ( i= 0 ; i< sells; i++)
         {
         
            resp= OrderClose (sell_tickets[i],sell_lots[i], Ask , 2 , clrRed );
         }
         InitSell();
         
      }           
  }
  
  
 
MECMAN :

그리고 이것은 계속

mq4 파일을 첨부해주세요 - 이렇게 하면 사용자가 쉽게 테스트할 수 없고 도움을 드릴 수 없습니다.
[삭제]  

헤이 멜라덴

나는 이 웹사이트를 처음 접했고 당신의 좋은 작품을 볼 수 있습니다. 계속 지켜봐 주세요. 그러나 지표를 EA로 전환하는 방법에 대한 코딩을 도와주셨으면 합니다.

내가 정말로 필요한 것은 신호가 나타날 때 EA가 구매하거나 판매하는 것입니다.

아이디어는 더 높은 기간인 4시간 tf로 이동하여 시장의 추세를 찾고(추세를 알기 위해) 더 낮은 tf(15-5분)에서 거래하는 것입니다. 따라서 짧은 경우 추세의 변화가 더 높은 기간 동안 만 짧 습니다.

미리 감사드립니다.

[삭제]  
mladen :
mq4 파일을 첨부해주세요 - 이렇게 하면 사용자가 쉽게 테스트할 수 없고 도움을 드릴 수 없습니다.
업로드됨, 아무도 이 코드를 살펴보고 테스트할 수 없는 이유를 알 수 있습니다. 결과는 수익성이 없을 수 있지만 감사할 것입니다.
파일:
VPro3.mq4  21 kb
 
MECMAN :
업로드됨, 아무도 이 코드를 살펴보고 테스트할 수 없는 이유를 알 수 있습니다. 결과는 수익성이 없을 수 있지만 감사할 것입니다.

작동합니다(표시기 폴더에 "vertex_mod_3.01" 표시기가 있는 한)