MT5 to PRT
Forums › ProRealTime forum Français › Support ProBuilder › MT5 to PRT
- This topic has 5 replies, 2 voices, and was last updated 7 years ago by Plscap.
-
-
05/25/2017 at 1:36 PM #36629
Bonjour à tous et bonjour à toi Nicolas,
Je me permets de créer ce topic pour savoir si quelqu’un aurait possibilité (et la grande amabilité)
de transformer un indicateur MT5 en PRT.
Voici le code de l’indicateur123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137#property indicator_separate_window#property indicator_buffers 3#property indicator_plots 3//--- plot InClose#property indicator_label1 "In Close"#property indicator_type1 DRAW_LINE#property indicator_color1 clrRed#property indicator_style1 STYLE_SOLID#property indicator_width1 2//--- plot OutClose#property indicator_label2 "Out Close"#property indicator_type2 DRAW_LINE#property indicator_color2 clrBlueViolet#property indicator_style2 STYLE_SOLID#property indicator_width2 2//--- plot DirectClose#property indicator_label3 "Direct Close"#property indicator_type3 DRAW_LINE#property indicator_color3 clrWhite#property indicator_style3 STYLE_SOLID#property indicator_width3 2//--- indicator levels#property indicator_level1 0#property indicator_level2 3#property indicator_level3 -3#property indicator_levelcolor clrGray//--- indicator buffersdouble InCloseBuffer[];double OutCloseBuffer[];double DirectCloseBuffer[];//--- global variablesint minRequiredBars;//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+int OnInit() {//---minRequiredBars = 1;//--- indicator buffers mappingSetIndexBuffer(0, InCloseBuffer, INDICATOR_DATA);SetIndexBuffer(1, OutCloseBuffer, INDICATOR_DATA);SetIndexBuffer(2, DirectCloseBuffer, INDICATOR_DATA);//---for ( int i = 0; i < 3; i++ ) {PlotIndexSetInteger(i, PLOT_DRAW_BEGIN, minRequiredBars);PlotIndexSetInteger(i, PLOT_SHIFT, 0);PlotIndexSetDouble(i, PLOT_EMPTY_VALUE, EMPTY_VALUE);}//---IndicatorSetInteger(INDICATOR_DIGITS, 0);//---IndicatorSetString(INDICATOR_SHORTNAME, "Close Series");//---return(0);}//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+int OnCalculate(const int rates_total,const int prev_calculated,const datetime &time[],const double &open[],const double &high[],const double &low[],const double &close[],const long &tick_volume[],const long &volume[],const int &spread[]){//---int startBar;//---if ( rates_total < minRequiredBars ) {Print("Íåäîñòàòî÷íî áàðîâ äëÿ ðàñ÷¸òà.");return(0);}//---if ( prev_calculated > rates_total || prev_calculated <= 0 ) {startBar = minRequiredBars;for ( int bar = 0; bar < minRequiredBars; bar++ ) {InCloseBuffer[bar] = 0.0;OutCloseBuffer[bar] = 0.0;DirectCloseBuffer[bar] = 0.0;}} else {startBar = prev_calculated - 1;}//---for ( int bar = startBar; bar < rates_total && !IsStopped(); bar++ ) {int prevBar = bar - 1;//---if ( close[bar] <= high[prevBar] && close[bar] >= low[prevBar] ) {if ( InCloseBuffer[prevBar] > 0 ) {InCloseBuffer[bar] = InCloseBuffer[prevBar] + 1;} else {InCloseBuffer[bar] = 1;}} else {InCloseBuffer[bar] = 0;}//---if ( open[bar] > high[prevBar] ) {if ( OutCloseBuffer[prevBar] > 0 ) {OutCloseBuffer[bar] = OutCloseBuffer[prevBar] + 1;} else {OutCloseBuffer[bar] = 1;}} else if (open[bar] < low[prevBar] ) {if ( OutCloseBuffer[prevBar] < 0 ) {OutCloseBuffer[bar] = OutCloseBuffer[prevBar] - 1;} else {OutCloseBuffer[bar] = -1;}} else {OutCloseBuffer[bar] = 0;}//---if ( close[bar] > open[bar] ) {if ( DirectCloseBuffer[prevBar] > 0 ) {DirectCloseBuffer[bar] = DirectCloseBuffer[prevBar] + 1;} else {DirectCloseBuffer[bar] = 1;}} else if ( close[bar] < open[bar] ) {if ( DirectCloseBuffer[prevBar] < 0 ) {DirectCloseBuffer[bar] = DirectCloseBuffer[prevBar] - 1;} else {DirectCloseBuffer[bar] = -1;}} else {DirectCloseBuffer[bar] = 0;}}//--- return value of prev_calculated for next callreturn(rates_total);}//+------------------------------------------------------------------+Un grand merci d’avance 🙂
05/26/2017 at 8:22 AM #3667605/26/2017 at 10:45 AM #3669205/29/2017 at 2:20 PM #3691205/29/2017 at 2:36 PM #36921L’indicateur est désormais disponible au téléchargement dans notre bibliothèque juste ici :
https://www.prorealcode.com/prorealtime-indicators/close-series/
05/31/2017 at 9:44 AM #37099Bonjour Nicolas,
Un grand merci pour l’indicateur c’est parfaitement ça.
Alors cet indicateur moi je m’en sers sur des petites UT, essentiellement pour déterminer quand le cours va se retourner. pour ça j’attends que que la courbe Directclose atteigne un des niveaux.
Niveaux que je règle en fonction du marché, si marché sans tendance, niveaux plutôt serrés sinon niveaux un peu plus large
-
AuthorPosts
Find exclusive trading pro-tools on