please give me a help - page 2

 
Vladimir Karputov #:

You forgot to link the 'iMA1_UJ_H,iMA2_UJ_H' arrays:


Also, you didn't check: You don't check the result of handle creation. You must put a handle check.

Thank you for your reply.

Actually, I don't want to show those two lines (iMA1_UJ_H, iMA2_UJ_H), I just want to show usdBuffer of the comparison result of those two average lines.

My key problem is that after comparing the results, it reports overflow. Could you please test the program I originally posted and help me identify what is causing the overflow.

 
mfpg # :

Thank you for your reply.

Actually, I don't want to show those two lines (iMA1_UJ_H, iMA2_UJ_H), I just want to show usdBuffer of the comparison result of those two average lines.

My key problem is that after comparing the results, it reports overflow. Could you please test the program I originally posted and help me identify what is causing the overflow.

Your desire does not affect anything: you MUST link the arrays.

If it is an indicator array - you link it with 'INDICATOR_DATA', if it is an auxiliary array - with 'INDICATOR_CALCULATION'.


So, the homework remains the same: you MUST add two arrays (auxiliary) - these arrays will store the iMA values.


Add: Well, or at least carefully read !!!  already has it all!!!

please give me a help
please give me a help
  • 2022.06.09
  • www.mql5.com
Good morning. I wrote a code, but MT5 tell me ——2022.06.07 10:03:04.912 ask (USDJPY,H1) array out of range in 'ask...
 
mfpg #:

Thank you for your reply.

Actually, I don't want to show those two lines (iMA1_UJ_H, iMA2_UJ_H), I just want to show usdBuffer of the comparison result of those two average lines.

My key problem is that after comparing the results, it reports overflow. Could you please test the program I originally posted and help me identify what is causing the overflow.

Line number is shown in the message when you get that error, so go to that line and check whats wrong... perhaps by start commenting 
 
Vladimir Karputov #:

Your desire does not affect anything: you MUST link the arrays.

If it is an indicator array - you link it with 'INDICATOR_DATA', if it is an auxiliary array - with 'INDICATOR_CALCULATION'.


So, the homework remains the same: you MUST add two arrays (auxiliary) - these arrays will store the iMA values.


Add: Well, or at least carefully read !!!  already has it all!!!

I modified the following code according to your indicators, but there is still a problem, please take a look.


//+------------------------------------------------------------------+
//|                                                         ASK5.mq5 |
//|                                                              syh |
//+------------------------------------------------------------------+
 #property copyright "syh"
 #property link      "https://www.mql5.com"
 #property version   "1.00"
 #property indicator_separate_window
 #property indicator_buffers  7
 #property indicator_plots    1
 //--- plot usd
 #property indicator_label1    "USD"
 #property indicator_type1     DRAW_LINE
 #property indicator_color1    clrRed
 #property indicator_style1    STYLE_SOLID
 #property indicator_width1    1
 
 input int shiftbars  = 3000;     // number of bars for calculating the indicator
 
 //--- indicator buffers
 double    USDplot[];
 double    iMA1_UJ_Buffer[], iMA2_UJ_Buffer[],iMA3_UJ_Buffer[], iMA4_UJ_Buffer[],iMA5_UJ_Buffer[], iMA6_UJ_Buffer[];
 int       sig_USD[], iMA1_UJ,iMA2_UJ,iMA3_UJ,iMA4_UJ,iMA5_UJ,iMA6_UJ;
 int       limit,  i ;
 int       sig1=0 ;// sig2=0 ,sig3=0 , sig4=0 ,sig5=0 , sig6=0 ;
 //+------------------------------------------------------------------+
 //| Custom indicator initialization function                         |
 //+------------------------------------------------------------------+
 int OnInit ()
  {
 //--- indicator buffers mapping 
   SetIndexBuffer ( 0 ,USDplot         , INDICATOR_DATA );
   SetIndexBuffer ( 1 ,iMA1_UJ_Buffer  , INDICATOR_CALCULATIONS );
   SetIndexBuffer ( 2 ,iMA2_UJ_Buffer  , INDICATOR_CALCULATIONS );
   SetIndexBuffer ( 3 ,iMA3_UJ_Buffer  , INDICATOR_CALCULATIONS );
   SetIndexBuffer ( 4 ,iMA4_UJ_Buffer  , INDICATOR_CALCULATIONS );
   SetIndexBuffer ( 5 ,iMA5_UJ_Buffer  , INDICATOR_CALCULATIONS );
   SetIndexBuffer ( 6 ,iMA6_UJ_Buffer  , INDICATOR_CALCULATIONS ); 
   iMA1_UJ = iMA ( "USDJPY" , 0 , 5  , 0 , MODE_SMA , PRICE_CLOSE );
   iMA2_UJ = iMA ( "USDJPY" , 0 , 10 , 0 , MODE_SMA , PRICE_CLOSE );
   iMA3_UJ = iMA ( "USDJPY" , 0 , 15 , 0 , MODE_SMA , PRICE_CLOSE );
   iMA4_UJ = iMA ( "USDJPY" , 0 , 20 , 0 , MODE_SMA , PRICE_CLOSE );
   iMA5_UJ = iMA ( "USDJPY" , 0 , 25 , 0 , MODE_SMA , PRICE_CLOSE );
   iMA6_UJ = iMA ( "USDJPY" , 0 , 30 , 0 , MODE_SMA , PRICE_CLOSE );
   
   ArraySetAsSeries(sig_USD,true);    ArrayInitialize(sig_USD,EMPTY_VALUE);
 //--- 
   return ( INIT_SUCCEEDED );
  }
 
 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[])
  {
   //countedK = prev_calculated;
   if(prev_calculated>0)
     {limit=1;}
   else
     {limit=shiftbars;}

//   if (USD)
      {
        for(i=limit;i>=0;i--)//for(j=limit-1;j>=0;j--)
           { sig1=0 ; //sig2=0 ; sig3=0 ; sig4=0 ; sig5=0 ; sig6=0 ; //应该一汇种一个SIG;
             if (iMA1_UJ_Buffer[i] >iMA2_UJ_Buffer[i] ) sig1=sig1+1 ; else sig1=sig1-1 ;
             if (iMA1_UJ_Buffer[i] >iMA3_UJ_Buffer[i] ) sig1=sig1+2 ; else sig1=sig1-2 ;
             if (iMA1_UJ_Buffer[i] >iMA4_UJ_Buffer[i] ) sig1=sig1+3 ; else sig1=sig1-3 ;
             if (iMA1_UJ_Buffer[i] >iMA5_UJ_Buffer[i] ) sig1=sig1+4 ; else sig1=sig1-4 ;
             if (iMA1_UJ_Buffer[i] >iMA6_UJ_Buffer[i] ) sig1=sig1+5 ; else sig1=sig1-5 ;
             
             if (iMA2_UJ_Buffer[i] >iMA3_UJ_Buffer[i] ) sig1=sig1+2 ; else sig1=sig1-2 ;
             if (iMA2_UJ_Buffer[i] >iMA4_UJ_Buffer[i] ) sig1=sig1+3 ; else sig1=sig1-3 ;
             if (iMA2_UJ_Buffer[i] >iMA5_UJ_Buffer[i] ) sig1=sig1+4 ; else sig1=sig1-4 ;
             if (iMA2_UJ_Buffer[i] >iMA6_UJ_Buffer[i] ) sig1=sig1+5 ; else sig1=sig1-5 ;
             
             if (iMA3_UJ_Buffer[i] >iMA4_UJ_Buffer[i] ) sig1=sig1+3 ; else sig1=sig1-3 ;
             if (iMA3_UJ_Buffer[i] >iMA5_UJ_Buffer[i] ) sig1=sig1+4 ; else sig1=sig1-4 ;
             if (iMA3_UJ_Buffer[i] >iMA6_UJ_Buffer[i] ) sig1=sig1+5 ; else sig1=sig1-5 ;
             
             if (iMA4_UJ_Buffer[i] >iMA5_UJ_Buffer[i] ) sig1=sig1+4 ; else sig1=sig1-4 ;
             if (iMA4_UJ_Buffer[i] >iMA6_UJ_Buffer[i] ) sig1=sig1+5 ; else sig1=sig1-5 ;
             
             if (iMA5_UJ_Buffer[i] >iMA6_UJ_Buffer[i] ) sig1=sig1+5 ; else sig1=sig1-5 ;


             ArrayResize(sig_USD,3000);
             
             sig_USD[i]=+sig1;

           }

//=====================      
        for(i=limit-1;i>=0;i--) 
           {
            USDplot[i]=MathPow(sig_USD[i]+sig_USD[StringToInteger(DoubleToString(MathFloor(i/4),0))],3)/MathPow(1000,3);
           }
     }
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
 can i withdraw mg acct at Mt5? How? My broker is not responding.. 
 
Hello please help me. My 6000 dollars become zero as in zero. I accidentally click a currency and click the buy and after 3 seconds my money become zero?what would i do please help what happen in the margin? Please help me please 
Reason: