Indicatore PerfectTrend

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #132196 quote
    danistutadanistuta
    Participant
    Senior
    //PRC_PerfectTrendLine ptl | indicator
    //16.10.2017
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //converted from MT4 version (original author mladen)
    //enhanced version by Nicolas
    
    // --- settings
    //SlowLength         = 7 // Slow length
    //SlowPipDisplace    = 0 // Slow pip displace
    //FastLength         = 3 // Fast length
    //FastPipDisplace    = 0 // Fast pip displace
    // --- end of settings
    
    thigh1 = Highest[SlowLength](high)+ SlowPipDisplace*pointsize
    tlow1  = Lowest[SlowLength](low)- SlowPipDisplace*pointsize
    thigh2 = Highest[FastLength](high)+ FastPipDisplace*pointsize
    tlow2  = Lowest[FastLength](low)- FastPipDisplace*pointsize
    
    if barindex>2 then
    if Close>line1[1] then
    line1 = tlow1
    else
    line1 = thigh1
    endif
    if Close>line2[1] then
    line2 = tlow2
    else
    line2 = thigh2
    endif
    endif
    
    if (Close[0]<line1[0] and Close[0]<line2[0]) then
    trend =  1
    endif
    if (Close[0]>line1[0] and Close[0]>line2[0]) then
    trend = -1
    endif
    if (line1[0]>line2[0] or trend[0] =  1) then
    trena =  1
    endif
    if (line1[0]<line2[0] or trend[0] = -1) then
    trena = -1
    endif
    if trena<>trena[1] then
    if trena=1 then
    x = max(line1,line2)
    r=200
    g=20
    b=60
    else
    x = min(line1,line2)
    r=30
    g=144
    b=255
    endif
    drawtext("●",barindex,x,Dialog,Bold,10) coloured(r,g,b)
    endif
    drawbarchart(line1,line2,line1,line2) coloured(r,g,b,50)
    
    return line1 coloured(r,g,b,100) style(line,1),line2 coloured(r,g,b,100) style(line,1)
    
     
    

    Salve, vorrei vendere solo quando l’indicatore segna il pallino rosso e comprare in corrispondenza del pallino blu…qualcuno mi da una  mano con il codice, che mi sono un po’ annodato 🙂 Grazie mille.

    #132199 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Ecco fatto:

    DEFPARAM CumulateOrders = false
    SlowLength         = 7 // Slow length
    SlowPipDisplace    = 0 // Slow pip displace
    FastLength         = 3 // Fast length
    FastPipDisplace    = 0 // Fast pip displace
    thigh1 = Highest[SlowLength](high)+ SlowPipDisplace*pointsize
    tlow1  = Lowest[SlowLength](low)- SlowPipDisplace*pointsize
    thigh2 = Highest[FastLength](high)+ FastPipDisplace*pointsize
    tlow2  = Lowest[FastLength](low)- FastPipDisplace*pointsize
    if barindex>2 then
       if Close>line1[1] then
          line1 = tlow1
       else
          line1 = thigh1
       endif
       if Close>line2[1] then
          line2 = tlow2
       else
          line2 = thigh2
       endif
    endif
    if (Close[0]<line1[0] and Close[0]<line2[0]) then
       trend =  1
    endif
    if (Close[0]>line1[0] and Close[0]>line2[0]) then
       trend = -1
    endif
    if (line1[0]>line2[0] or trend[0] =  1) then
       trena =  1
    endif
    if (line1[0]<line2[0] or trend[0] = -1) then
       trena = -1
    endif
    if trena<>trena[1] AND Not OnMarket then
       if trena=1 then
          SELL 1 contract at market
       else
          BUY 1 contract at market
       endif
    endif
    Set Target pProfit 100
    Set Stop  pLoss    50
    #132200 quote
    danistutadanistuta
    Participant
    Senior

    Grazie molte, funziona solo l’entrata in long

    #132201 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Scusa, hai ragione, la riga 36 deve essere:

    SELLSHORT 1 contract at market
    #132202 quote
    danistutadanistuta
    Participant
    Senior

    Vero, non mi ero accorto! 🙂 Però mettendo l’indicatore a confronto, in alcuni punti non entra a mercato…da cosa può dipendere?

    #132206 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Sarà già a mercato.

    #132208 quote
    danistutadanistuta
    Participant
    Senior

    No, ancheq  non è a mercato in dei punti non entra.

    #132211 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Dimmi lo strumento ed il TF su cui l’hai provato e data e ora delle candele in cui doveva entrare e mon l’ha fatto.

    #132214 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Prova anche questa strategia fatta da Nicolas https://www.prorealcode.com/topic/perfect-trend-indicator/#post-50725

Viewing 9 posts - 1 through 9 (of 9 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

Indicatore PerfectTrend


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
danistuta @danistuta Participant
Summary

This topic contains 8 replies,
has 2 voices, and was last updated by robertogozzirobertogozzi
6 years, 4 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 05/18/2020
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...