Conversion indicateur Snake Force de mt4

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #97571 quote
    MaximeMaxime
    Participant
    New

    Bonjour,
    est-ce qu’il serait possible de convertir ce code vers Prorealcode svp? J’èspere qu’il ne manque pas d’info?
    Merci beaucoup

    //+------------------------------------------------------------------+
    
    //| SnakeInBorders.mq4 |
    
    //| "ÈÍÄÈÊÀÒÎÐÛ ÄËß ÑÀÌÎÎÁÌÀÍÀ" |
    
    //| Bookkeeper, 2006, yuzefovich@gmail.com |
    
    //+------------------------------------------------------------------+
    
    #property copyright ""
    
    #property link ""
    
    //+------------------------------------------------------------------+
    
    #property indicator_separate_window
    
    #property indicator_buffers 4
    
    #property indicator_color1 Lime
    
    #property indicator_color2 Red
    
    #property indicator_color3 Lime
    
    #property indicator_color4 Red
    
    //----
    
    extern int cPeriod=24;
    
    //----
    
    double ForceUp[];
    
    double ForceDown[];
    
    double ResistanceUp[];
    
    double ResistanceDown[];
    
    double Mart[];
    
    //----
    
    double Snake_Sum, Snake_Weight, Snake_Sum_Minus, Snake_Sum_Plus;
    
    //----
    
    int init()
    
    {
    
    int draw_begin;
    
    double indperiod,val1,val2;
    
    string CommentStr;
    
    draw_begin=3*cPeriod;
    
    IndicatorBuffers(5);
    
    SetIndexBuffer(0,ForceUp);
    
    SetIndexBuffer(1,ForceDown);
    
    SetIndexBuffer(2,ResistanceUp);
    
    SetIndexBuffer(3,ResistanceDown);
    
    SetIndexBuffer(4,Mart);
    
    SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,2);
    
    SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,2);
    
    SetIndexStyle(2,DRAW_HISTOGRAM);
    
    SetIndexStyle(3,DRAW_HISTOGRAM);
    
    SetIndexStyle(4,DRAW_NONE);
    
    SetIndexLabel(2,NULL);
    
    SetIndexLabel(3,NULL);
    
    SetIndexLabel(4,NULL);
    
    SetIndexDrawBegin(0,draw_begin);
    
    SetIndexDrawBegin(1,draw_begin);
    
    SetIndexDrawBegin(2,draw_begin);
    
    SetIndexDrawBegin(3,draw_begin);
    
    SetIndexDrawBegin(4,draw_begin);
    
    indperiod=1.0*cPeriod*Period();
    
    if(indperiod<60)
    
    {
    
    CommentStr=DoubleToStr(indperiod,0);
    
    CommentStr=" M"+CommentStr+", FORCE UP -DOWN ";
    
    }
    
    else
    
    {
    
    indperiod=indperiod/60;
    
    if(indperiod>=24)
    
    {
    
    val1=MathAbs(MathRound(indperiod/24)-indperiod/24);
    
    if(val1<0.01)
    
    {
    
    CommentStr=DoubleToStr(indperiod/24,0);
    
    CommentStr=" D"+CommentStr+", FORCE UP -DOWN ";
    
    }
    
    else
    
    {
    
    CommentStr=DoubleToStr(indperiod/24,1);
    
    CommentStr=" D"+CommentStr+", FORCE UP -DOWN ";
    
    }
    
    }
    
    else
    
    {
    
    val1=MathAbs(MathRound(indperiod)-indperiod);
    
    if(val1<0.01)
    
    {
    
    CommentStr=DoubleToStr(indperiod,0);
    
    CommentStr=" H"+CommentStr+", FORCE UP -DOWN ";
    
    }
    
    else
    
    {
    
    CommentStr=DoubleToStr(indperiod,1);
    
    CommentStr=" H"+CommentStr+", FORCE UP -DOWN ";
    
    }
    
    }
    
    }
    
    IndicatorShortName("SnakeInBorders"+CommentStr);
    
    return(0);
    
    }
    
    //----
    
    void deinit()
    
    {
    
    }
    
    //----
    
    int start()
    
    {
    
    int FirstPos, ExtCountedBars=0,i;
    
    if(Bars<=50) return(0);
    
    if(cPeriod<21) return(0);
    
    ExtCountedBars=IndicatorCounted();
    
    if (ExtCountedBars<0) return(-1);
    
    if (ExtCountedBars>0) ExtCountedBars--;
    
    FirstPos=Bars-ExtCountedBars-1;
    
    if(FirstPos>Bars-cPeriod-7)
    
    {
    
    FirstPos=Bars-cPeriod-7;
    
    Mart[FirstPos+cPeriod]=SnakeFirstCalc(FirstPos+cPeriod);
    
    for(i=FirstPos+cPeriod-1;i>FirstPos;i--) SnakeNextCalc(i);
    
    }
    
    Snake(FirstPos);
    
    return(0);
    
    }
    
    //----
    
    void Snake(int Pos)
    
    {
    
    int i;
    
    if(Pos<6) Pos=6;
    
    Mart[Pos]=SnakeFirstCalc(Pos);
    
    Drawing(Pos);
    
    Pos--;
    
    while(Pos>=5)
    
    {
    
    Mart[Pos]=SnakeNextCalc(Pos);
    
    Drawing(Pos);
    
    Pos--;
    
    }
    
    while(Pos>0)
    
    {
    
    Mart[Pos]=SnakeFirstCalc(Pos);
    
    Drawing(Pos);
    
    Pos--;
    
    }
    
    if(Pos==0)
    
    {
    
    // Mart[Pos]=iMA(NULL,0,6,0,MODE_LWMA,PRICE_TYPICAL,0);
    
    Mart[Pos]=iMA(NULL,0,6,0,MODE_LWMA,PRICE_CLOSE,0);
    
    Drawing(Pos);
    
    }
    
    return;
    
    }
    
    //----
    
    double SnakePrice(int Shift)
    
    {
    
    // return((2*Close[shift]+High[shift]+Low[shift])/4);
    
    return(Close[shift]);
    
    }
    
    //----
    
    double SnakeFirstCalc(int Shift)
    
    {
    
    int i, j, w;
    
    Snake_Sum=0.0;
    
    if(Shift<5)
    
    {
    
    Snake_Weight=0.0;
    
    i=0;
    
    w=Shift+5;
    
    while(w>=Shift)
    
    {
    
    i++;
    
    Snake_Sum=Snake_Sum+i*SnakePrice(w);
    
    Snake_Weight=Snake_Weight+i;
    
    w--;
    
    }
    
    while(w>=0)
    
    {
    
    i--;
    
    Snake_Sum=Snake_Sum+i*SnakePrice(w);
    
    Snake_Weight=Snake_Weight+i;
    
    w--;
    
    }
    
    }
    
    else
    
    {
    
    Snake_Sum_Minus=0.0;
    
    Snake_Sum_Plus=0.0;
    
    for(j=Shift-5,i=Shift+5,w=1; w<=5; j++,i--,w++)
    
    {
    
    Snake_Sum=Snake_Sum+w*(SnakePrice(i)+SnakePrice(j));
    
    Snake_Sum_Minus=Snake_Sum_Minus+SnakePrice(i);
    
    Snake_Sum_Plus=Snake_Sum_Plus+SnakePrice(j);
    
    }
    
    Snake_Sum=Snake_Sum+6*SnakePrice(Shift);
    
    Snake_Sum_Minus=Snake_Sum_Minus+SnakePrice(Shift);
    
    Snake_Weight=36;
    
    }
    
    return(Snake_Sum/Snake_Weight);
    
    }
    
    //----
    
    double SnakeNextCalc(int Shift)
    
    {
    
    Snake_Sum_Plus=Snake_Sum_Plus+SnakePrice(Shift-5);
    
    Snake_Sum=Snake_Sum-Snake_Sum_Minus+Snake_Sum_Plus;
    
    Snake_Sum_Minus=Snake_Sum_Minus-SnakePrice(Shift+6)+SnakePrice(Shift);
    
    Snake_Sum_Plus=Snake_Sum_Plus-SnakePrice(Shift);
    
    return(Snake_Sum/Snake_Weight);
    
    }
    
    //----
    
    void Drawing(int Shift)
    
    {
    
    double val,Dval,val1,val2,val11,val22,val3;
    
    val= 5*(Mart[shift]-Mart[ArrayMinimum(Mart,cPeriod,Shift)])/9;
    
    Dval=5*(Mart[shift]-
    
    Mart[shift+1]+
    
    Mart[ArrayMinimum(Mart,cPeriod,Shift+1)]-
    
    Mart[ArrayMinimum(Mart,cPeriod,Shift)] )/9;
    
    if(Dval>0)
    
    {
    
    ForceUp[shift]=val;
    
    ResistanceUp[shift]=0;
    
    }
    
    else
    
    {
    
    ForceUp[shift]=0;
    
    ResistanceUp[shift]=val;
    
    }
    
    val= 5*(Mart[shift]-Mart[ArrayMaximum(Mart,cPeriod,Shift)])/9;
    
    Dval=5*(Mart[shift]-
    
    Mart[shift+1]+
    
    Mart[ArrayMaximum(Mart,cPeriod,Shift+1)]-
    
    Mart[ArrayMaximum(Mart,cPeriod,Shift)] )/9;
    
    if(Dval<0)
    
    {
    
    ForceDown[shift]=val;
    
    ResistanceDown[shift]=0;
    
    }
    
    else
    
    {
    
    ForceDown[shift]=0;
    
    ResistanceDown[shift]=val;
    
    }
    
    return;
    
    }
    eurusdh4.thumb_.gif.0bb192c5fb2fbeebed5d868e049c5cea.png eurusdh4.thumb_.gif.0bb192c5fb2fbeebed5d868e049c5cea.png
    #98060 quote
    NicolasNicolas
    Keymaster
    Legend

    Serait-il possible de poster le fichier .mq4 ? Plus simple et rapide pour moi, merci.

    #98115 quote
    MaximeMaxime
    Participant
    New

    Bonjour, non désolé c’est copié collé d’un forum us je n’ai pas trouvé de fichier, mais si c’est trop long et trop complexe laissez tomber ne vous prenez pas la tête, merci quand même.

    #98169 quote
    NicolasNicolas
    Keymaster
    Legend

    Non c’est juste que ça peut me faire gagner 5 minutes 🙂

    Je peux bien entendu convertir l’indicateur si vraiment tu le souhaites, aucun problème !

    #148853 quote
    octoberoctober
    Participant
    Junior

    Good morning Nicolas

     

    Here is the mq4 file. I will appreciate it if you can convert it to prorealcode.

     

    Regards

    Tobie

    snake-force.zip
    #148862 quote
    octoberoctober
    Participant
    Junior

    I have added a screen shot and a description as required:

    BUY:

    1. Snake Body is down touching the Canal

    2. The Path became visible again behind the Snake body because the Snake start rising

    3. Snake Force down is off

    SELL:

    1. Snake Body is high touching the Canal

    2. The Path became visible again behind the Snake body because the Snake start fall

    3. Snake Force oscillator high is off

    snake-force.png snake-force.png
    #148866 quote
    JC_BywanJC_Bywan
    Moderator
    Master
    @october bonjour, merci de respecter les règles de publication dans le grand cadre jaune ci-dessous, en particulier écrire dans la même langue que le forum auquel on participe (translation: thanks for respecting the forum rules in the big yellow box below, in particular using the same language as the forum you contribute to, using automatic translator if needed)
Viewing 7 posts - 1 through 7 (of 7 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

Conversion indicateur Snake Force de mt4


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Maxime @maxime_lara Participant
Summary

This topic contains 6 replies,
has 4 voices, and was last updated by JC_BywanJC_Bywan
5 years, 10 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 05/02/2019
Status: Active
Attachments: 3 files
ProRealCode ProRealCode
Loading...