Convertire codice MT4 indicatore GoldenLionTrend_v3 a PRT

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #115287 quote
    Riccardo
    Participant
    Senior

    Buongiorno chiedo gentilmente se è possibile convertire un codice da MT4 a PRT

    Grazie

    Il codice è il seguente:

    //+------------------------------------------------------------------+
    //| i4_GoldenLionTrend_v3
    //| goldenlion@ukr.net
    //| http://GlobeInvestFund.com/
    //+------------------------------------------------------------------+
    #property copyright "Copyright c 2006, http://GlobeInvestFund.com/, goldenlion@ukr.net"
    #property link "http://GlobeInvestFund.com/"
    
    #property indicator_chart_window
    #property indicator_buffers 4
    #property indicator_color1 LightBlue
    #property indicator_color2 Pink
    #property indicator_color3 Blue
    #property indicator_color4 Red
    
    //---- input parameters
    extern int MyPeriod=44;
    
    extern double Dev1=0.1;
    extern double Dev2=1;
    
    //---- buffers
    double val1[];
    double val2[];
    
    double val3[];
    double val4[];
    
    double bh1, bl1, bh2, bl2, bm, bh3, bl3;
    
    //+------------------------------------------------------------------+
    //| Custom indicator initialization function |
    //+------------------------------------------------------------------+
    int init()
    {
    string short_name;
    //---- indicator line
    IndicatorBuffers(4);
    
    SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,2);
    SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,2);
    
    SetIndexStyle(2,DRAW_HISTOGRAM,EMPTY,2);
    SetIndexStyle(3,DRAW_HISTOGRAM,EMPTY,2);
    
    SetIndexBuffer(0,val1);
    SetIndexBuffer(1,val2);
    
    SetIndexBuffer(2,val3);
    SetIndexBuffer(3,val4);
    //----
    return(0);
    }
    //+------------------------------------------------------------------+
    //| SilverTrend |
    //+------------------------------------------------------------------+
    int start()
    {
    int i1,i2,K;
    double Range,AvgRange,smin,smax,SsMax,SsMin,price;
    bool uptrend,old;
    int shift, ii, counted_bars=IndicatorCounted();
    double V1, V2;
    
    //----
    if( Bars <= MyPeriod ) return(0); shift=Bars-MyPeriod*1.1; if( counted_bars >= MyPeriod ) shift=Bars-MyPeriod*1.1;
    
    while(shift>=0)
    {
    bm = iBands(NULL,0,MyPeriod,0,0,PRICE_CLOSE,MODE_UPPER,shift);
    
    bh1 = iBands(NULL,0,MyPeriod,Dev1,0,PRICE_CLOSE,MODE_UPPER,shift);
    bl1 = iBands(NULL,0,MyPeriod,Dev1,0,PRICE_CLOSE,MODE_LOWER,shift);
    
    bh2 = iBands(NULL,0,MyPeriod,Dev2,0,PRICE_CLOSE,MODE_UPPER,shift);
    bl2 = iBands(NULL,0,MyPeriod,Dev2,0,PRICE_CLOSE,MODE_LOWER,shift);
    
    val1[shift]=0;
    val2[shift]=0;
    
    val3[shift]=0;
    val4[shift]=0;
    
    if( Low[shift] > bh1 )
    {
    val1[shift]=High[shift];
    val2[shift]=Low[shift];
    }
    
    if( High[shift] < bl1 ) { val1[shift]=Low[shift]; val2[shift]=High[shift]; } if( Low[shift] > bh2 )
    {
    val1[shift]=0;
    val2[shift]=0;
    val3[shift]=High[shift];
    val4[shift]=Low[shift];
    }
    
    if( High[shift] < bl2 )
    {
    val1[shift]=0;
    val2[shift]=0;
    val3[shift]=Low[shift];
    val4[shift]=High[shift];
    }
    
    shift--;
    
    }
    return(0);
    }
    //+------------------------------------------------------------------+
    golden.png golden.png
    #115295 quote
    Nicolas
    Keymaster
    Master

    Questo indicatore mostra i grafici a barre in base alle posizioni alte / basse relative a 2 set di bande di Bollinger dello stesso periodo ma con deviazione diversa. Molto semplice. Ecco il codice tradotto:

    // --- settings 
    MyPeriod=44
    Dev1=0.1
    Dev2=1
    // --- end of settings 
    
    bm = average[myperiod](close)
     
    bh1 = bm+std[myperiod](close)*Dev1
    bl1 = bm-std[myperiod](close)*Dev1
     
    bh2 = bm+std[myperiod](close)*Dev2
    bl2 = bm-std[myperiod](close)*Dev2
    
    alpha=0
    
    if( Low > bh1 ) then 
    r=173
    g=216
    b=230
    alpha=255
    endif
    
    if( High < bl1 ) then
    r=255
    g=192
    b=203
    alpha=255
    endif 
    
    if( Low > bh2 ) then 
    r=0
    g=0
    b=255
    alpha=255
    endif
    
    if( High < bl2 ) then 
    r=255
    g=0
    b=0
    alpha=255
    endif
    
    drawbarchart(open,high,low,close) coloured(r,g,b,alpha)
    
    return

     

    goldenlion-trend-indicator-mt4.png goldenlion-trend-indicator-mt4.png
    #115302 quote
    Riccardo
    Participant
    Senior

    Ma che Spettacolo Nicolas !!!!!

    veramente molto bravo ….

    mille Grazie

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

Convertire codice MT4 indicatore GoldenLionTrend_v3 a PRT


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Riccardo @riccardo_lanz Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Riccardo
6 years, 3 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 12/20/2019
Status: Active
Attachments: 2 files
Logo Logo
Loading...