SEÑAL-RUIDO
Forums › ProRealTime foro Español › Soporte ProBuilder › SEÑAL-RUIDO
- This topic has 2 replies, 2 voices, and was last updated 7 years ago by Nicolas.
-
-
12/19/2016 at 5:04 PM #18803
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.
123456789101112131415161718192021REM SEÑAL-RUIDO// n = número entero>0 por defecto=14pi = 3.141592653589793distancia = ABS(close - close[n])recorrido = summation[n](ABS(close-close[1]))IF 1 THENeficacia=1elseeficacia=distancia/recorridoendifIF -1 THENeficacia=-1elseeficacia=distancia/recorridoendifreturn eficacia as "SEÑAL-RUIDO", 1/ pi*0.5 as "Frontera"12/19/2016 at 10:22 PM #18834El 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);1 user thanked author for this post.
12/20/2016 at 12:56 PM #18854 -
AuthorPosts