코딩 도움말 - 페이지 675

 
traderduke :
전체 추세에는 1 2ma를 사용하고 단기 고점 및 저점 재진입에는 다른 것을 사용합니다.
두 개의 전압 채널 표시기가 있어야 한다는 뜻입니까?
 

안녕하세요 코더입니다.

이 질문에 대한 도움이 필요합니다. 간단한 ma 교차 표시기의 수평 화살표 신호를 이동하는 방법은 무엇입니까?

나는 이것을 시도했지만 왼쪽으로 만 이동합니다. 오른쪽으로도 필요합니다.

감사해요

 //+------------------------------------------------------------------+
//|                                                   ma crosses.mq4 |
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1  Blue
#property indicator_color2  Red
#property indicator_color3  LimeGreen
#property indicator_color4  Magenta

//
//
//
//
//

extern int     FastMa             = 13 ;
extern int     FastMaShift        = 0 ;
extern int     FastMAMethod       = MODE_EMA ;
extern int     FastMAPrice        = PRICE_CLOSE ;
extern int     SlowMa             = 68 ;
extern int     SlowMaShift        = 0 ;
extern int     SlowMAMethod       = MODE_SMA ;
extern int     SlowMAPrice        = PRICE_CLOSE ;
extern bool    ShowMaLines        = true ;

extern string note               = "turn on Alert = true; turn off = false" ;
extern bool    alertsOn           = true ;
extern bool    alertsOnCurrent    = true ;
extern bool    alertsMessage      = true ;
extern bool    alertsSound        = true ;
extern bool    alertsEmail        = false ;
extern string soundfile          = "alert2.wav" ;

extern string note7              = "Arrow Type" ;
extern string note8              = "0=default,1=Thick,2=Thin,3=Hollow" ;
extern string note9              = "4=Round,5=Fractal,6=Diagonal Thin" ;
extern string note10             = "7=Diagonal Thick,8=Diagonal Hollow" ;
extern string note11             = "9=Thumb,10=Finger" ;
extern int     ArrowType          = 2 ;
extern int     arrowthickness     = 2 ;
extern double arrowsDisplacement = 2.0 ;
extern int     arrowHshift        = 0 ;

//
//
//
//
//

double CrossUp[];
double CrossDn[];
double fastMA[];
double slowMA[];
double trend[];

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
{
   IndicatorBuffers ( 5 );   
   
   if (ArrowType == 0 ) {
   SetIndexBuffer ( 0 , CrossUp);   SetIndexStyle ( 0 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 0 , 119 );
   SetIndexBuffer ( 1 , CrossDn );   SetIndexStyle ( 1 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 1 , 119 );
   }
   if (ArrowType == 1 ) {
   SetIndexBuffer ( 0 , CrossUp);   SetIndexStyle ( 0 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 0 , 233 );
   SetIndexBuffer ( 1 , CrossDn);   SetIndexStyle ( 1 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 1 , 234 );
   }
   else if (ArrowType == 2 ) { 
   SetIndexBuffer ( 0 , CrossUp);   SetIndexStyle ( 0 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 0 , 225 );
   SetIndexBuffer ( 1 , CrossDn);   SetIndexStyle ( 1 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 1 , 226 );
   }
   else if (ArrowType == 3 ) { 
   SetIndexBuffer ( 0 , CrossUp);   SetIndexStyle ( 0 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 0 , 241 );
   SetIndexBuffer ( 1 , CrossDn);   SetIndexStyle ( 1 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 1 , 242 );
   }
   else if (ArrowType == 4 ) { 
   SetIndexBuffer ( 0 , CrossUp);   SetIndexStyle ( 0 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 0 , 221 );
   SetIndexBuffer ( 1 , CrossDn);   SetIndexStyle ( 1 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 1 , 222 );
   }
   else if (ArrowType == 5 ) { 
   SetIndexBuffer ( 0 , CrossUp);   SetIndexStyle ( 0 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 0 , 217 );
   SetIndexBuffer ( 1 , CrossDn);   SetIndexStyle ( 1 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 1 , 218 );
   }
   else if (ArrowType == 6 ) { 
   SetIndexBuffer ( 0 , CrossUp);   SetIndexStyle ( 0 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 0 , 228 );
   SetIndexBuffer ( 1 , CrossDn);   SetIndexStyle ( 1 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 1 , 230 );
   }
   else if (ArrowType == 7 ) { 
   SetIndexBuffer ( 0 , CrossUp);   SetIndexStyle ( 0 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 0 , 236 );
   SetIndexBuffer ( 1 , CrossDn);   SetIndexStyle ( 1 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 1 , 238 );
   }
   else if (ArrowType == 8 ) { 
   SetIndexBuffer ( 0 , CrossUp);   SetIndexStyle ( 0 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 0 , 246 );
   SetIndexBuffer ( 1 , CrossDn);   SetIndexStyle ( 1 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 1 , 248 );
   }
   else if (ArrowType == 9 ) { 
   SetIndexBuffer ( 0 , CrossUp);   SetIndexStyle ( 0 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 0 , 67 );
   SetIndexBuffer ( 1 , CrossDn);   SetIndexStyle ( 1 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 1 , 68 );
   }
   else if (ArrowType == 10 ) { 
   SetIndexBuffer ( 0 , CrossUp);   SetIndexStyle ( 0 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 0 , 71 );
   SetIndexBuffer ( 1 , CrossDn);   SetIndexStyle ( 1 , DRAW_ARROW , 0 ,arrowthickness); SetIndexArrow ( 1 , 72 );
   }
   SetIndexBuffer ( 2 , fastMA);
   SetIndexBuffer ( 3 , slowMA);
   SetIndexBuffer ( 4 , trend);
   
   if (ShowMaLines)
   {
     SetIndexStyle ( 2 , DRAW_LINE ); 
     SetIndexStyle ( 3 , DRAW_LINE ); 
   }
   else
   {
     SetIndexStyle ( 2 , DRAW_NONE );
     SetIndexStyle ( 3 , DRAW_NONE );
   }       
   
return ( 0 );
}

//
//
//
//
//

int deinit() {   return ( 0 ); }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
//
//
//
//

int start() {
   int counted_bars= IndicatorCounted ();
   int i,limit;

   if (counted_bars< 0 ) return (- 1 );
   if (counted_bars> 0 ) counted_bars--;
         limit = MathMin ( Bars -counted_bars, Bars - 1 );
         
   //
   //
   //
   //
   //
            
   for (i=limit; i>= 0 ; i--)
   {
      fastMA[i]  = iMA ( NULL , 0 ,FastMa,FastMaShift,FastMAMethod,FastMAPrice,i);
      slowMA[i]  = iMA ( NULL , 0 ,SlowMa,SlowMaShift,SlowMAMethod,SlowMAPrice,i);
       double gap = iATR ( NULL , 0 , 20 ,i); 
      
      trend[i] = trend[i+ 1 ];
         if (fastMA[i]>slowMA[i]) trend[i] = 1 ;
         if (fastMA[i]<slowMA[i]) trend[i] =- 1 ;

         //
         //
         //
         //
         //
      
         CrossUp[i] = EMPTY_VALUE ;
         CrossDn[i] = EMPTY_VALUE ;
         if (trend[i]!= trend[i+ 1 ])
         if (trend[i] == 1 )
               CrossUp[i+arrowHshift] = Low [i]  - arrowsDisplacement * gap;
         else   CrossDn[i+arrowHshift] = High [i] + arrowsDisplacement * gap; 
         }
         
         if (alertsOn)
         {
         if (alertsOnCurrent)
               int whichBar = 0 ;
         else      whichBar = 1 ;

         //
         //
         //
         //
         //
         
         if (trend[whichBar] != trend[whichBar+ 1 ])
         if (trend[whichBar] == 1 )
               doAlert( "uptrend" );
         else   doAlert( "downtrend" );       
   }
   
   return ( 0 );
}
//+------------------------------------------------------------------+


void doAlert( string doWhat)
{
   static string    previousAlert= "nothing" ;
   static datetime previousTime;
   string message;
   
       if (previousAlert != doWhat || previousTime != Time [ 0 ]) {
          previousAlert  = doWhat;
          previousTime   = Time [ 0 ];

           //
           //
           //
           //
           //

          message =   StringConcatenate ( Symbol (), " at " , TimeToStr ( TimeLocal (), TIME_SECONDS ), " ma cross " ,doWhat);
             if (alertsMessage) Alert (message);
             if (alertsEmail)   SendMail ( StringConcatenate ( Symbol (), " ma cross " ),message);
             if (alertsSound)   PlaySound (soundfile);
      }
}

 
thefxpros :

안녕하세요 코더입니다.

이 질문에 대한 도움이 필요합니다. 간단한 ma 교차 표시기의 수평 화살표 신호를 이동하는 방법은 무엇입니까?

나는 이것을 시도했지만 왼쪽으로 만 이동합니다. 오른쪽으로도 필요합니다.

감사해요

단일 값을 이동하는 대신 버퍼를 이동하려고 했습니까?

다음과 같은 것:

   SetIndexShift ( 0 ,arrowHshift);
   SetIndexShift ( 1 ,arrowHshift);

그런 다음이 라인을 전환하여 전혀 이동하지 않습니다.

 //
// instead of 
//


         if (trend[i] == 1 )
               CrossUp[i+arrowHshift] = Low [i]  - arrowsDisplacement * gap;
         else   CrossDn[i+arrowHshift] = High [i] + arrowsDisplacement * gap; 

//
// it has to be
//

         if (trend[i] == 1 )
               CrossUp[i] = Low [i]  - arrowsDisplacement * gap;
         else   CrossDn[i] = High [i] + arrowsDisplacement * gap; 
 
thefxpros :

안녕하세요 코더입니다.

이 질문에 대한 도움이 필요합니다. 간단한 ma 교차 표시기의 수평 화살표 신호를 이동하는 방법은 무엇입니까?

나는 이것을 시도했지만 왼쪽으로 만 이동합니다. 오른쪽으로도 필요합니다.

감사해요

추신: 이제 값을 이동하려면 + 값을 사용하여 화살표를 오른쪽으로 이동하고 - 값을 사용하여 값을 왼쪽으로 이동해야 합니다(테스트 코드를 첨부하면 화살표를 왼쪽 또는 오른쪽으로 이동하는 모든 경우에 정상 작동합니다. )

파일:
_test.mq4  8 kb
 
mladen :
두 개의 전압 채널 표시기가 있어야 한다는 뜻입니까?

믈라덴

더 빨리 답을 드리지 못해 죄송합니다. 지표 질문에 대한 해결책을 가지고 돌아오려고 했지만 그렇게 되지 않았습니다.

네, 맞습니다. 오해해서 죄송합니다. 나는 2MA 지표에 대해 스티븐에게 대답했다. MR 도구가 PrCh 표시기에 대해 했던 것처럼 입장 및 재진입 모두에 대해 기존 표시기를 사용할 수 없었지만, 내 EA는 재진입을 올바르게 할 수 없었습니다. 그것은 연기 속의 스윙과 같습니다.

어쨌든 2볼티로 EA에서 할 수 있으므로 이 표시기를 만들 필요가 없습니다.


도와 주셔서 감사합니다

레이

 
Pls는 이 표시기를 EA로 코딩하는 것을 도와줄 수 있습니다
 

안녕하세요.

나는 확률적 교차에 따른 수요-공급 지표 를 기반으로 경고를 하려고 합니다. 이 표시기는 버퍼에 정보를 저장하기 때문에 EA를 크레이트하는 데 사용할 수 있지만 아직 mql4를 읽고 이해하는 데 자신이 없으며 2-3개월 이상의 실험 시간이 없습니다.

따라서 누군가가 iCustom 라인을 작성하여 가격이 zoene 내에 있는지 여부를 확인하는 데 도움을 줄 수 있기를 바랍니다.

 //+------------------------------------------------------------------+
//|                                              Indicator: chan.mq4 |
//|                                       Created with EABuilder.com |
//|                                             http://eabuilder.com |
//+------------------------------------------------------------------+
#property copyright "Created with EABuilder.com"
#property link        "http://eabuilder.com"
#property version    "1.00"
#property description ""

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

//--- indicator settings
#property indicator_chart_window
#property indicator_buffers 2

#property indicator_type1 DRAW_ARROW
#property indicator_width1 5
#property indicator_color1 0xFFAA00
#property indicator_label1 "Buy"

#property indicator_type2 DRAW_ARROW
#property indicator_width2 5
#property indicator_color2 0x1A00FF
#property indicator_label2 "Sell"

//--- indicator buffers
double Buffer1[];
double Buffer2[];

double myPoint; //initialized in OnInit

void myAlert( string type, string message)
  {
   if (type == "print" )
       Print (message);
   else if (type == "error" )
     {
       Print (type+ " | chan @ " + Symbol ()+ "," + Period ()+ " | " +message);
     }
   else if (type == "order" )
     {
     }
   else if (type == "modify" )
     {
     }
  }

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {   
   IndicatorBuffers ( 2 );
   SetIndexBuffer ( 0 , Buffer1);
   SetIndexEmptyValue ( 0 , 0 );
   SetIndexArrow ( 0 , 241 );
   SetIndexBuffer ( 1 , Buffer2);
   SetIndexEmptyValue ( 1 , 0 );
   SetIndexArrow ( 1 , 242 );
   //initialize myPoint
   myPoint = Point ();
   if ( Digits () == 5 || Digits () == 3 )
     {
      myPoint *= 10 ;
     }
   return ( INIT_SUCCEEDED );
  }

//+------------------------------------------------------------------+
//| 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[])
  {
   int limit = rates_total - prev_calculated;
   //--- counting from 0 to rates_total
   ArraySetAsSeries (Buffer1, true );
   ArraySetAsSeries (Buffer2, true );
   //--- initial zero
   if (prev_calculated < 1 )
     {
       ArrayInitialize (Buffer1, 0 );
       ArrayInitialize (Buffer2, 0 );
     }
   else
      limit++;
   
   //--- main loop
   for ( int i = limit- 1 ; i >= 0 ; i--)
     {
       if (i >= MathMin ( 5000 - 1 , rates_total- 1 - 50 )) continue ; //omit some old rates to prevent "Array out of range" or slow calculation   
       //Indicator Buffer 1
       if ( iStochastic ( NULL , PERIOD_CURRENT , 5 , 3 , 3 , MODE_SMA , 0 , MODE_MAIN , i) < 20
      && iStochastic ( NULL , PERIOD_CURRENT , 5 , 3 , 3 , MODE_SMA , 0 , MODE_MAIN , i+ 1 ) > 20 //Stochastic Oscillator crosses below fixed value
          !!!!!  && iCustom ( NULL , PERIOD_CURRENT , "shved_supply_and_demand" , i ***************** check if price is in upper zone
      )
        {
         Buffer1[i] = Low [i]; //Set indicator value at Candlestick Low
        }
       else
        {
         Buffer1[i] = 0 ;
        }
       //Indicator Buffer 2
       if ( iStochastic ( NULL , PERIOD_CURRENT , 5 , 3 , 3 , MODE_SMA , 0 , MODE_MAIN , i) > 80
      && iStochastic ( NULL , PERIOD_CURRENT , 5 , 3 , 3 , MODE_SMA , 0 , MODE_MAIN , i+ 1 ) < 80 //Stochastic Oscillator crosses above fixed value
           !!!! && iCustom ( NULL , PERIOD_CURRENT , "shved_supply_and_demand" , i ***************  check if price is in lower zone
      )
        {
         Buffer2[i] = High [i]; //Set indicator value at Candlestick High
        }
       else
        {
         Buffer2[i] = 0 ;
        }
     }
   return (rates_total);
  }
//+------------------------------------------------------------------+

나는 누군가가 나를 돕는 데 시간을 투자할 것이라고 기대하지 않습니다. 그러나 내가 게시하지 않으면 전혀 기회가 없으므로 시도해볼 수 있습니다.

평화와 사랑 동료 상인

파일:
 
NWFstudent :

안녕하세요.

나는 확률적 교차에 따른 수요-공급 지표를 기반으로 경고를 하려고 합니다. 이 표시기는 버퍼에 정보를 저장하기 때문에 EA를 크레이트하는 데 사용할 수 있지만 아직 mql4를 읽고 이해하는 데 자신이 없으며 2-3개월 이상의 실험 시간이 없습니다.

따라서 누군가가 iCustom 라인을 작성하여 가격이 zoene 내에 있는지 여부를 확인하는 데 도움을 줄 수 있기를 바랍니다.

나는 누군가가 나를 돕는 데 시간을 투자할 것이라고 기대하지 않습니다. 그러나 내가 게시하지 않으면 전혀 기회가 없으므로 시도해볼 수 있습니다.

평화와 사랑 동료 상인

이렇게 하세요(댓글도 확인하세요 )

   //
   //
   // checking if the price is withing the lower zone
   //
   //
   
   if ( Close [i] <= iCustom ( NULL , PERIOD_CURRENT , "shved_supply_and_demand" , 6 ,i) &&
       Close [i] >= iCustom ( NULL , PERIOD_CURRENT , "shved_supply_and_demand" , 7 ,i))
   //
   //
   // checking if the price is withing the upper zone
   //
   //
   
   if ( Close [i] <= iCustom ( NULL , PERIOD_CURRENT , "shved_supply_and_demand" , 4 ,i) &&
       Close [i] >= iCustom ( NULL , PERIOD_CURRENT , "shved_supply_and_demand" , 5 ,i))
       
   //
   //
   // PS: that indicator stores values only for current bar in the buffers, so it works only for i==0
   //
   //
   //       
 
mladen :

이렇게 하세요(댓글도 확인하세요)

감사합니다. 모든 페이지에서 가장 친절한 관리자여야 합니다. 당신의 작업은 매우 감사합니다.

잘 지내세요.

 
dotmund :
Pls는 이 표시기를 EA로 코딩하는 것을 도와줄 수 있습니다

도와주세요