Please Help about draw moving average line

 

I want to draw blue line after red line

My opinion want to use MA lag and have predict line ( blue line ). May be use constant value to create it.

But i 'm newbie for mt4 then i don't know how to code it.

Please help me too

Regards,

Tack

 
  1. t2a5c2k9:
    I want to draw blue line after red line
    My opinion want to use MA lag and have predict line ( blue line ). May be use constant value to create it.
    Based upon the image, you want to extend the back shifted MA
    #define MA_PERIOD 14
    #define MA_SHIFT  -5
    #define MA_METHOD  0 // MODE_SMA
    #define MA_PRICE   PRICE_CLOSE // ?
    int start(){
       double currMA = iMA(NULL, 0, MA_PERIOD, MA_SHIFT, MA_METHOD, MA_PRICE, 0),
              prevMA = iMA(NULL, 0, MA_PERIOD, MA_SHIFT, MA_METHOD, MA_PRICE, 1),
              slope  = currMA - prevMA;
       Tline("predict", Time[-MA_SHIFT], currMA, Time[-MA_SHIFT-1], currMA+slope, Blue, true);
    }
    void TLine( string name, datetime T0, double P0, datetime T1, double P1
              , color clr, bool ray=false ){                #define WINDOW_MAIN 0
        if      (ObjectMove( name, 0, T0, P0 ))     ObjectMove(name, 1, T1, P1);
        else if (!ObjectCreate( name, OBJ_TREND, WINDOW_MAIN, T0, P0, T1, P1 ))
            Alert("ObjectCreate(",name,",TREND) failed: ", GetLastError() );
        else if (!ObjectSet( name, OBJPROP_RAY, ray ))
            Alert("ObjectSet(", name, ",Ray) failed: ", GetLastError());
        if (!ObjectSet(name, OBJPROP_COLOR, clr )) // Allow color change
            Alert("ObjectSet(", name, ",Color) [2] failed: ", GetLastError());
        string  P0t = PriceToStr(P0);           if (MathAbs(P0 - P1) >= Point)
                P0t = StringConcatenate(P0t, " to ", PriceToStr(P1));
        if (!ObjectSetText(name, P0t, 10))
            Alert("ObjectSetText(",name,") [2] failed: ", GetLastError());
    }
    string  PriceToStr(double p){ return( DoubleToStr(p, Digits) ); }
  2. t2a5c2k9:
    But i 'm newbie for mt4 then i don't know how to code it.
    No Slaves here, learn to code or pay someone. We're not going to code it FOR you. We are willing to HELP you.
 
WHRoeder:
  1. t2a5c2k9:
    I want to draw blue line after red line
    My opinion want to use MA lag and have predict line ( blue line ). May be use constant value to create it.
    Based upon the image, you want to extend the back shifted MA
  2. t2a5c2k9:
    But i 'm newbie for mt4 then i don't know how to code it.
    No Slaves here, learn to code or pay someone. We're not going to code it FOR you. We are willing to HELP you.


OK Thank

Your code is good guide for me.

I will try to learn and help other too

Reason: