SEÑAL-RUIDO

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #18803 quote
    bolsatrilerabolsatrilera
    Participant
    Master

    De este interesante artículo http://www.x-trader.net/articulos/trading-general/el-poder-de-pi.html   

    donde aparece un indicador para Metatrader llamado Signal to Noise Ratio, he intentado hacer el mismo para Prorealtime.

    REM SEÑAL-RUIDO
    // n = número entero>0 por defecto=14
    
    pi = 3.141592653589793
    
    distancia = ABS(close - close[n])
    
    recorrido = summation[n](ABS(close-close[1]))
    
    IF 1 THEN
    eficacia=1
    else
    eficacia=distancia/recorrido
    endif
    IF -1 THEN
    eficacia=-1
    else
    eficacia=distancia/recorrido
    endif
    
    return  eficacia as "SEÑAL-RUIDO", 1/ pi*0.5 as "Frontera"
    
    eurusd.png eurusd.png
    #18834 quote
    bolsatrilerabolsatrilera
    Participant
    Master

    El código de la plataforma Metatrader del indicador Signal to Noise Ratio :

    //+——————————————————————+
    //| Shaun-Pi-2.mq4 |
    //| Copyright 2015,SyneAsya Pte Ltd. |
    //| http://www.SyneAsya.com|
    //+——————————————————————+

    #property copyright “Copyright 2015,SyneAsya Pte Ltd.”

    #property link “www.SyneAsya.com”
    #property version “2.00”
    #property strict
    #property indicator_separate_window
    #property indicator_buffers 2

    #property indicator_minimum -0.00001

    extern string MyPair = “EURUSD”;
    extern bool MySymbol = FALSE; //False = Symbol on the chart // True = MyPair
    extern int BarsBack = 1000;
    extern int MyLookBackShift = 14;
    extern color CLR1 = Yellow;
    double Buf0[];

    double Buf1[];
    double MyClose[10000];
    double AbsCh[10000];
    double LookBackShift[10000];
    double MyWalk[10000];
    double MyDistance[10000];
    double MyDTWRatio[10000];

    double MyB;
    //+——————————————————————+

    //| Custom indicator initialization function |

    //+——————————————————————+

    int OnInit()

    {

    SetIndexBuffer(0,Buf0);
    SetIndexLabel(0,MyPair);
    SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2,CLR1);

    SetIndexBuffer(1,Buf1);
    SetIndexLabel(1,”MyPiRatio”);
    SetIndexStyle (1,DRAW_LINE,STYLE_DOT,1,clrWhite);

    double MyPiRatio = 1/3.14159265358979*0.5;
    SetLevelValue( 0, MyPiRatio ) ;
    SetLevelStyle( STYLE_DOT , 1 , Silver ) ;

    IndicatorShortName(“SNRatio2 (“+IntegerToString(Period())+”)”);

    return(0);

    //—

    return(INIT_SUCCEEDED);

    }
    int start()

    {

    int limit;
    int counted_bars=IndicatorCounted();
    limit=MathMin(Bars-counted_bars,BarsBack-MyLookBackShift-2);

    if(counted_bars>0) counted_bars–;
    {
    //====================================================

    for(int i = 0; i < limit; i++)
    {
    string Pair;
    if(MySymbol == TRUE)
    {
    Pair = MyPair;
    }
    else
    if(MySymbol == FALSE)
    {
    Pair = Symbol();
    }
    double A = iClose(Pair,Period(),i);
    MyClose[i] = A;
    }
    //====================================================

    for(int i = 0; i < limit; i++)
    {
    LookBackShift[i] = MyClose[i+MyLookBackShift];
    }
    //====================================================

    for(int i = 0; i < limit; i++)
    {
    AbsCh[i] = MathAbs(MyClose[i] – MyClose[i+1]);
    MyDistance[i] = MathAbs(MyClose[i]-LookBackShift[i]);
    }
    //====================================================

    for(int i = 0; i < limit; i++)
    {
    MyB = 0;
    for(int y = 0; y < MyLookBackShift + 1; y++)
    {
    MyB = MyB + AbsCh[y+i];
    }
    MyWalk[i] = MyB; //Print(“MyWalk”,” “,MyWalk[i]);
    }

    //====================================================
    for(int i = 0; i < limit; i++)
    {
    MyDTWRatio[i] = MyDistance[i]/MyWalk[i];

    }
    double MyPiRatio = 1/3.14159265358979/2;
    for(int i = 0; i < limit; i++)
    {

    Buf0[i] = MyDTWRatio[i];
    Buf1[i] = MyPiRatio;
    }

    }
    return(0);

    wisconsin thanked this post
    #18854 quote
    NicolasNicolas
    Keymaster
    Legend

    Su indicador MT4 se ha convertido con éxito a prorealtime. Lo añadiré a la Biblioteca más adelante, no dude en otras conversiones si es necesario.

    signal-to-noise-ratio-indicator-1.png signal-to-noise-ratio-indicator-1.png PRC_SignalToNoiseRatio-1.itf
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

SEÑAL-RUIDO


ProBuilder: Indicadores y Herramientas

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by NicolasNicolas
9 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicadores y Herramientas
Language: Spanish
Started: 12/19/2016
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...