Traducir de mq4 a Prt:"Relative Strength rank"
- This topic has 3 replies, 2 voices, and was last updated 5 years ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
Similar topics:
Forums › ProRealTime foro Español › Soporte ProBuilder › Traducir de mq4 a Prt:"Relative Strength rank"
Nicolás sería tan amable de traducir este código a PRT?Lo encuentro muy interesante para determinar la fortaleza de cualquier valor.
Gracias
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
//------------------------------------------------------------------ // //------------------------------------------------------------------ #property copyright #property link #property indicator_separate_window #property indicator_buffers 6 #property indicator_color1 DeepSkyBlue #property indicator_color2 DeepSkyBlue #property indicator_color3 PaleVioletRed #property indicator_color4 PaleVioletRed #property indicator_color5 DimGray #property indicator_color6 DimGray #property indicator_width1 2 #property indicator_width3 2 #property indicator_width5 2 #property indicator_style6 STYLE_DOT // // // // // extern int RsrPrice = PRICE_CLOSE; extern int RsrShortPeriod = 20; extern int RsrLongPeriod = 140; extern int RsrMaMode = MODE_SMA; extern int AtrPeriod = 10; extern bool ShowHistogram = true; // // // // // double rsr[]; double rsrHuu[]; double rsrHud[]; double rsrHdu[]; double rsrHdd[]; double zli[]; //------------------------------------------------------------------ // //------------------------------------------------------------------ // // // // // int init() { if (ShowHistogram) int drawStyle = DRAW_HISTOGRAM; else drawStyle = DRAW_NONE; // // // // // SetIndexBuffer(0,rsrHuu); SetIndexStyle(0,drawStyle); SetIndexBuffer(1,rsrHud); SetIndexStyle(1,drawStyle); SetIndexBuffer(2,rsrHdd); SetIndexStyle(2,drawStyle); SetIndexBuffer(3,rsrHdu); SetIndexStyle(3,drawStyle); SetIndexBuffer(4,rsr); SetIndexBuffer(5,zli); IndicatorShortName("Relative Strength Rank ("+RsrShortPeriod+","+RsrLongPeriod+","+AtrPeriod+")"); return(0); } int deinit() { return(0); } //------------------------------------------------------------------ // //------------------------------------------------------------------ // // // // // double work[][2]; #define _trend 0 #define _slope 1 int start() { int i,r,limit,counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit = MathMin(Bars-counted_bars,Bars-2); if (ArrayRange(work,0)!=Bars) ArrayResize(work,Bars); // // // // // for(i=limit, r=Bars-i-1; i>=0; i--,r++) { double price = iMA(NULL,0,1 ,0,MODE_SMA ,RsrPrice,i); double mas = iMA(NULL,0,RsrShortPeriod,0,RsrMaMode,RsrPrice,i); double mal = iMA(NULL,0,RsrLongPeriod ,0,RsrMaMode,RsrPrice,i); double atr = iATR(NULL,0,AtrPeriod,i); if (atr!=0) rsr[i] = (price-mas+price-mal)/(2.0*atr); else rsr[i] = 0; // // // // // zli[i] = 0; rsrHuu[i] = EMPTY_VALUE; rsrHud[i] = EMPTY_VALUE; rsrHdu[i] = EMPTY_VALUE; rsrHdd[i] = EMPTY_VALUE; work[r][_slope] = work[r-1][_slope]; if (rsr[i]>rsr[i+1]) work[r][_slope] = 1; if (rsr[i]<rsr[i+1]) work[r][_slope] = -1; if (rsr[i]>0) if (work[r][_slope]==1) rsrHuu[i] = rsr[i]; else rsrHud[i] = rsr[i]; if (rsr[i]<0) if (work[r][_slope]==-1) rsrHdd[i] = rsr[i]; else rsrHdu[i] = rsr[i]; } return(0); } |
Codifiqué el indicador, puede descargarlo aquí: Indicador de Rango de Fuerza Relativa
Find exclusive trading pro-tools on