Language Probuilder tsi oscilateur et trader dynamic index visual MT4

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #16951 quote
    Carl
    Participant
    Average

    Ci-dessous une demande qui a été envoyée à ProRealTime :

    bonjour je souhaite passer des indicateur mt4 sur prt
    merci de m’indiquer la possibilité de codage merci
    les indicateur s”apelle tsi oscilateur et trader dynamic index visual

    xxxxx
    //|                                                                  |
    //|   RSI Price Line & Signal Line Type settings                     |
    //|   0 = Simple moving average       [DEFAULT]                      |
    //|   1 = Exponential moving average                                 |
    //|   2 = Smoothed moving average                                    |
    //|   3 = Linear weighted moving average                             |
    //|                                                                  |
    //|   Good trading,                                                  |
    //|                                                                  |
    //|   Dean                                                           |
    //+——————————————————————+
    #property indicator_separate_window
    #property indicator_buffers 7
    //—-
    #property indicator_color1 Black
    #property indicator_color2 MediumBlue
    #property indicator_color3 Yellow
    #property indicator_color4 MediumBlue
    #property indicator_color5 Green
    #property indicator_color6 Red
    #property indicator_color7 Aqua
    #property indicator_style7 2
    //#property indicator_maximum 85
    //#property indicator_minimum 15
    extern bool Show_VISUAL_Alerts=true;
    extern int SHIFT_Sideway=0;
    extern int SHIFT_Up_Down=0;
    extern int RSI_Period=13;         //8-25
    extern int RSI_Price=0;           //0-6
    extern int Volatility_Band=34;    //20-40
    extern int RSI_Price_Line=2;
    extern int RSI_Price_Type=0;      //0-3
    extern int Trade_Signal_Line=7;
    extern bool SHOW_Trade_Signal_Line2=true;
    extern int Trade_Signal_Line2=18;
    extern int Trade_Signal_Type=0;   //0-3
    //—-
    #define UPPERLINE “UPPERLINE”
    #define MEDLINE “MEDLINE”
    #define LOWERLINE “LOWERLINE”
    //—-
    double RSIBuf[],UpZone[],MdZone[],DnZone[],MaBuf[],MbBuf[],McBuf[];
    //+——————————————————————+
    //|                                                                  |
    //+——————————————————————+
    int init()
    {
    IndicatorShortName(“Traders Dynamic Index Visual”);
    SetIndexBuffer(0,RSIBuf);
    SetIndexBuffer(1,UpZone);
    SetIndexBuffer(2,MdZone);
    SetIndexBuffer(3,DnZone);
    SetIndexBuffer(4,MaBuf);
    SetIndexBuffer(5,MbBuf);
    //—-
    if(SHOW_Trade_Signal_Line2 ==true){SHOW_Trade_Signal_Line2=DRAW_LINE; }
    else {SHOW_Trade_Signal_Line2=DRAW_NONE; }
    SetIndexStyle(6,SHOW_Trade_Signal_Line2);
    SetIndexBuffer(6,McBuf);
    //
    SetIndexStyle(0,DRAW_NONE);
    SetIndexStyle(1,DRAW_LINE);
    SetIndexStyle(2,DRAW_LINE,0,2);
    SetIndexStyle(3,DRAW_LINE);
    SetIndexStyle(4,DRAW_LINE,0,2);
    SetIndexStyle(5,DRAW_LINE,0,1);
    //
    SetIndexLabel(0,NULL);
    SetIndexLabel(1,”VB High”);
    SetIndexLabel(2,”Market Base Line”);
    SetIndexLabel(3,”VB Low”);
    SetIndexLabel(4,”RSI Price Line”);
    SetIndexLabel(5,”Trade Signal Line”);
    SetIndexLabel(6,”Trade Signal2 Line”);
    /* SetLevelValue(0,50);
    SetLevelValue(1,68);
    SetLevelValue(2,32);
    SetLevelStyle(STYLE_DOT,1,DarkSlateGray);*/
    return(0);
    }
    //+——————————————————————+
    //|                                                                  |
    //+——————————————————————+
    int deinit()
    {
    ObjectsDeleteAll(0,OBJ_TREND);
    ObjectDelete(“TDI_SIG”);ObjectDelete(“TDI_SIG1”);ObjectDelete(“TDI_SIG2”);
    ObjectDelete(“TDI_SIG3”);ObjectDelete(“TDI_SIG4”);ObjectDelete(“TDI_SIG5”);
    ObjectDelete(“TDI_SIG6”);ObjectDelete(“TDI_SIG7”);ObjectDelete(“TDI_SIG8”);
    ObjectDelete(“TDI_SIG9”);
    //—-
    return(0);
    }
    //+——————————————————————+
    //|                                                                  |
    //+——————————————————————+
    int start()
    {
    CreateLEVEL();
    }
    //+——————————————————————+
    //|                                                                  |
    //+——————————————————————+
    void Createline(string objName, double start, double end, color clr)
    {
    ObjectCreate(objName, OBJ_TREND,WindowFind(“Traders Dynamic Index Visual”),0, start, Time[0], end);
    ObjectSet(objName, OBJPROP_COLOR, clr);
    ObjectSet(objName, OBJPROP_STYLE, 2);
    ObjectSet(objName, OBJPROP_RAY, false);
    }
    //+——————————————————————+
    //|                                                                  |
    //+——————————————————————+
    void DeleteCreateline()
    {
    ObjectDelete(UPPERLINE);ObjectDelete(LOWERLINE);ObjectDelete(MEDLINE);
    }
    //+——————————————————————+
    //|                                                                  |
    //+——————————————————————+
    void CreateLEVEL()
    {
    DeleteCreateline();
    Createline(UPPERLINE, 68, 68,C’70,70,70′);
    Createline(LOWERLINE, 50, 50,C’00,70,00′);
    Createline(MEDLINE, 32, 32,C’70,70,70′);
    //—-
    double MA,RSI[];
    ArrayResize(RSI,Volatility_Band);
    int counted_bars=IndicatorCounted();
    int limit=Bars-counted_bars-1;
    for(int i=limit; i>=0; i–)
    {
    RSIBuf[i]=(iRSI(NULL,0,RSI_Period,RSI_Price,i));
    MA=0;
    for(int x=i; x<i+Volatility_Band; x++)
    {
    RSI[x-i]=RSIBuf[x];
    MA+=RSIBuf[x]/Volatility_Band;
    }
    UpZone[i]=(MA + (1.6185 * StDev(RSI,Volatility_Band)));
    DnZone[i]=(MA – (1.6185 * StDev(RSI,Volatility_Band)));
    MdZone[i]=((UpZone[i] + DnZone[i])/2);
    }
    for(i=limit-1;i>=0;i–)
    {
    MaBuf[i]=(iMAOnArray(RSIBuf,0,RSI_Price_Line,0,RSI_Price_Type,i));
    MbBuf[i]=(iMAOnArray(RSIBuf,0,Trade_Signal_Line,0,Trade_Signal_Type,i));
    McBuf[i]=(iMAOnArray(RSIBuf,0,Trade_Signal_Line2,0,Trade_Signal_Type,i));
    //—-
    string Signal=””, Signal2=””,Signal2A=””, Signal3=””,Signal4=””,Signal5=””;
    color TDI_col,TDI_col2,TDI_col3,TDI_col4;
    if(Show_VISUAL_Alerts==true)
    {
    static double crossPrice;
    int crossDirection;crossDirection =0;
    //signals
    if((MaBuf[0]>MbBuf[0])&&(MbBuf[0]<MdZone[0])&&(MaBuf[0]< MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal=”é”;TDI_col=SeaGreen;}
    if((MaBuf[0]>MbBuf[0])&&(MbBuf[0]<MdZone[0])&&(MaBuf[0]< MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal2A=”Weak Buy”;TDI_col2=SeaGreen;}
    if((MaBuf[0]>MbBuf[0])&&(MbBuf[0]<MdZone[0])&&(MaBuf[0]< MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal2=” @ “+DoubleToStr(crossPrice,Digits)+””;TDI_col2=SeaGreen;}
    if((MaBuf[0]>MbBuf[0])&&(MbBuf[0]<MdZone[0])&&(MaBuf[0]< MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){crossPrice=Bid;crossDirection =2;}
    //
    if((MaBuf[0]<MbBuf[0])&&(MbBuf[0]> MdZone[0])&&(MaBuf[0]> MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal=”ê”;TDI_col=Orange;}
    if((MaBuf[0]<MbBuf[0])&&(MbBuf[0]> MdZone[0])&&(MaBuf[0]> MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal2A=”Weak Sell”;TDI_col2=Orange;}
    if((MaBuf[0]<MbBuf[0])&&(MbBuf[0]> MdZone[0])&&(MaBuf[0]> MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal2=” @ “+DoubleToStr(crossPrice,Digits)+””;TDI_col2=Orange;}
    if((MaBuf[0]<MbBuf[0])&&(MbBuf[0]> MdZone[0])&&(MaBuf[0]> MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){crossPrice=Bid;crossDirection =1;}
    //
    if((MaBuf[0]>MbBuf[0])&&(MbBuf[0]> MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal=”é”;TDI_col=Lime;}
    if((MaBuf[0]>MbBuf[0])&&(MbBuf[0]> MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal2A=”Strong Buy”;TDI_col2=Lime;}
    if((MaBuf[0]>MbBuf[0])&&(MbBuf[0]> MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal2=” @ “+DoubleToStr(crossPrice,Digits)+””;TDI_col2=Lime;}
    if((MaBuf[0]>MbBuf[0])&&(MbBuf[0]> MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){crossPrice=Bid;crossDirection =2;}
    //
    if((MaBuf[0]>MbBuf[0])&&(MaBuf[0]> MdZone[0])&&(MbBuf[0]< MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal2A=”Medium Buy”;TDI_col2=Green;}
    if((MaBuf[0]>MbBuf[0])&&(MaBuf[0]> MdZone[0])&&(MbBuf[0]< MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal2=” @ “+DoubleToStr(crossPrice,Digits)+””;TDI_col2=Green;}
    if((MaBuf[0]>MbBuf[0])&&(MaBuf[0]> MdZone[0])&&(MbBuf[0]< MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal5=”é”;TDI_col2=Green;}
    if((MaBuf[0]>MbBuf[0])&&(MaBuf[0]> MdZone[0])&&(MbBuf[0]< MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){crossPrice=Bid;crossDirection =2;}
    //
    if((MaBuf[0]<MbBuf[0])&&(MbBuf[0]< MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal=”ê”;TDI_col=Red;}
    if((MaBuf[0]<MbBuf[0])&&(MbBuf[0]< MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal2A=”Strong Sell”;TDI_col2=Red;}
    if((MaBuf[0]<MbBuf[0])&&(MbBuf[0]< MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal2=” @ “+DoubleToStr(crossPrice,Digits)+””;TDI_col2=Red;}
    if((MaBuf[0]<MbBuf[0])&&(MbBuf[0]< MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){crossPrice=Bid;crossDirection =1;}
    //
    if((MaBuf[0]<MbBuf[0])&&(MaBuf[0]< MdZone[0])&&(MbBuf[0]> MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal2A=”Medium Sell”;TDI_col2=Tomato;}
    if((MaBuf[0]<MbBuf[0])&&(MaBuf[0]< MdZone[0])&&(MbBuf[0]> MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal2=” @ “+DoubleToStr(crossPrice,Digits)+””;TDI_col2=Tomato;}
    if((MaBuf[0]<MbBuf[0])&&(MaBuf[0]< MdZone[0])&&(MbBuf[0]> MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){Signal5=”ê”;TDI_col2=Tomato;}
    if((MaBuf[0]<MbBuf[0])&&(MaBuf[0]< MdZone[0])&&(MbBuf[0]> MdZone[0])&&(MaBuf[0]>32)&&(MaBuf[0]<68)){crossPrice=Bid;crossDirection =1;}
    // reversals
    if(MaBuf[0]>=68){Signal=”ê”;TDI_col=Red;}
    if(MaBuf[0]>=68){crossPrice=Bid;crossDirection =2;}
    if(MaBuf[0]>=68){Signal2A=”Caution !”;TDI_col2=Red;}
    if(MaBuf[0]>=68){Signal2=” @ “+DoubleToStr(crossPrice,Digits)+””;TDI_col2=Red;}
    if(MaBuf[0]<=32){Signal=”é”;TDI_col=Red;}
    if(MaBuf[0]<=32){crossPrice=Bid;crossDirection =1;}
    if(MaBuf[0]<=32){Signal2A=”Caution !”;TDI_col2=Red;}
    if(MaBuf[0]<=32){Signal2=” @ “+DoubleToStr(crossPrice,Digits)+””;TDI_col2=Red;}
    //trend
    if(MbBuf[0]>MdZone[0]){Signal3=”é”;TDI_col3=Lime;}
    if((MbBuf[0]<MdZone[0])&&(MaBuf[0]>MdZone[0])){Signal3=”é”;TDI_col3=Orange;}
    if(MbBuf[0]<MdZone[0]){Signal3=”ê”;TDI_col3=Red;}
    if((MbBuf[0]>MdZone[0])&&(MaBuf[0]<MdZone[0])){Signal3=”é”;TDI_col3=Green;}
    //ranging
    if(UpZone[0]-DnZone[i]<20){Signal4=”Consolidation”;TDI_col4=Silver;}
    ObjectDelete(“TDI_SIG”);
    ObjectCreate(“TDI_SIG”, OBJ_LABEL,WindowFind(“Traders Dynamic Index Visual”), 0, 0);
    ObjectSetText(“TDI_SIG”,Signal, 25, “Wingdings”,TDI_col );
    ObjectSet(“TDI_SIG”, OBJPROP_CORNER, 1);
    ObjectSet(“TDI_SIG”, OBJPROP_XDISTANCE, 80+SHIFT_Sideway);
    ObjectSet(“TDI_SIG”, OBJPROP_YDISTANCE, 20+SHIFT_Up_Down);
    //
    ObjectDelete(“TDI_SIG1”);
    ObjectCreate(“TDI_SIG1”, OBJ_LABEL,WindowFind(“Traders Dynamic Index Visual”), 0, 0);
    ObjectSetText(“TDI_SIG1”,Signal2, 15, “Tahoma Narrow”,TDI_col2);
    ObjectSet(“TDI_SIG1”, OBJPROP_CORNER, 1);
    ObjectSet(“TDI_SIG1”, OBJPROP_XDISTANCE, 120+SHIFT_Sideway);
    ObjectSet(“TDI_SIG1”, OBJPROP_YDISTANCE, 30+SHIFT_Up_Down);
    //
    ObjectDelete(“TDI_SIG2”);
    ObjectCreate(“TDI_SIG2”, OBJ_LABEL,WindowFind(“Traders Dynamic Index Visual”), 0, 0);
    ObjectSetText(“TDI_SIG2”,Signal2A, 15, “Tahoma Narrow”,TDI_col2);
    ObjectSet(“TDI_SIG2”, OBJPROP_CORNER, 1);
    ObjectSet(“TDI_SIG2”, OBJPROP_XDISTANCE, 120+SHIFT_Sideway);
    ObjectSet(“TDI_SIG2”, OBJPROP_YDISTANCE, 10+SHIFT_Up_Down);
    //
    ObjectDelete(“TDI_SIG3”);
    ObjectCreate(“TDI_SIG3”, OBJ_LABEL,WindowFind(“Traders Dynamic Index Visual”), 0, 0);
    ObjectSetText(“TDI_SIG3”,Signal5, 25, “Wingdings”,TDI_col2 );
    ObjectSet(“TDI_SIG3”, OBJPROP_CORNER, 1);
    ObjectSet(“TDI_SIG3”, OBJPROP_XDISTANCE, 80+SHIFT_Sideway);
    ObjectSet(“TDI_SIG3”, OBJPROP_YDISTANCE, 20+SHIFT_Up_Down);
    //
    xxxx
    //+—————————————————————

    Et une proposition de réponse :

    Once RsiPeriod = 13
    Once VolatilityBand = 34
    Once RsiPricePeriod = 2
    Once TradeSignalPeriod = 7
    
    r = Rsi[RsiPeriod](Close)
    Ma = Summation[VolatilityBand](r / VolatilityBand)
    
    delta = 1.6185 * STD[VolatilityBand](r)
    Up = Ma + delta
    Down = Ma - delta
    
    RsiPriceLine = Average[RsiPricePeriod](r)
    TradeSignalLine = Average[TradeSignalPeriod](r)
    
    Return Up Coloured(0,0,200) as "Volatility Band High", Down Coloured(0,0,200) as "Volatility Band Down", Ma Coloured(200,200,0) as "Market Base Line", RsiPriceLine Coloured(0,200,0) as "RSI Price Line", TradeSignalLine Coloured(255,0,0) as "Trade Signal Line"
    #16955 quote
    Nicolas
    Keymaster
    Master

    For information, you’ll find another version of the TDI Traders Dynamic Index (John Malone) for ProRealTime code  in the Library.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Language Probuilder tsi oscilateur et trader dynamic index visual MT4


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Carl @carl Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
9 years, 3 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 11/22/2016
Status: Active
Attachments: No files
Logo Logo
Loading...