STRATEGIA CON ALPHATREND

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #236590 quote
    GaspareGaspare
    Participant
    Veteran
    //PRC_AlphaTrend | indicator
    //07.04.23
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //author: kivancozbilgic
     
    // --- settings 
    // AP = 14 //Common Period
    // coeff = 1 //Multiplier
    // --- end of settings 
     
    if (MoneyFlowIndex[ap]>=50) then
    magic=Low[0]-AverageTrueRange[ap](close)*coeff
    endif
     
    if (MoneyFlowIndex[ap]<50) then
    magic=High[0]+AverageTrueRange[ap](close)*coeff
    endif
     
    if (MoneyFlowIndex[ap]>=50 and magic<magic[1]) then
    magic=magic[1]
    endif
     
    if (MoneyFlowIndex[ap]<50 and magic>magic[1]) then
    magic=magic[1]
    endif
     
    if magic>magic[1] then
    r=0
    g=255
    elsif magic<magic[1]then
    r=255
    g=0
    endif
     
    return magic as "AlphaTrend" coloured(r,g,0) style(line,2)
    buonasera a tutti ciao Roberto per favore, si puo’ avere una strategia con questo indicatore? Se apre short, stop 1 tick sopra il massimo della candela precedente e profit dopo 3 candele successive compresa quella dell’apertura posizione Se apre long, stop 1 tick sotto il minimo della candela precedente e profit dopo 3 candele successive compresa quella dell’apertura posizione Grazie
    #236595 quote
    JSJS
    Participant
    Master

    Ciao,

    Prova questo…

    //PRC_AlphaTrend | Trading system
     
    AP = 14 //Common Period
    coeff = 1 //Multiplier
    NumberOfBars=2
     
    if (MoneyFlowIndex[ap]>=50) then
    magic=Low[0]-AverageTrueRange[ap](close)*coeff
    endif
     
    if (MoneyFlowIndex[ap]<50) then
    magic=High[0]+AverageTrueRange[ap](close)*coeff
    endif
     
    if (MoneyFlowIndex[ap]>=50 and magic<magic[1]) then
    magic=magic[1]
    endif
     
    if (MoneyFlowIndex[ap]<50 and magic>magic[1]) then
    magic=magic[1]
    endif
     
    if NOT OnMarket and magic>magic[1] then
    Buy 1 contract at Market
    Set Stop Price Low
    EndIf
    
    If NOT OnMarket and magic<magic[1]then
    SellShort 1 contract at Market
    Set Stop Price High
    endif
    
    If OnMarket and BarIndex-TradeIndex(1)>NumberOfBars then
    Sell at Market
    ExitShort at Market
    EndIf
    

    Gaspare and robertogozzi thanked this post
    Scherm­afbeelding-2024-08-22-om-07.13.39.jpg Scherm­afbeelding-2024-08-22-om-07.13.39.jpg
    #236625 quote
    AragornaAragorna
    Participant
    Average
    mi sono permesso di fare una piccola modifica, altrimenti continua ad aprire posizioni. e ho messo lo stop una candela prima,altrimenti spesso chiude nella stessa candela
    //PRC_AlphaTrend | Trading system
     DEFPARAM CumulateOrders = false
    AP = 14 //Common Period
    coeff = 1 //Multiplier
    NumberOfBars=5
     
    if (MoneyFlowIndex[ap]>=50) then
    magic=Low[0]-AverageTrueRange[ap](close)*coeff
    endif
     
    if (MoneyFlowIndex[ap]<50) then
    magic=High[0]+AverageTrueRange[ap](close)*coeff
    endif
     
    if (MoneyFlowIndex[ap]>=50 and magic<magic[1]) then
    magic=magic[1]
    endif
     
    if (MoneyFlowIndex[ap]<50 and magic>magic[1]) then
    magic=magic[1]
    endif
    
    if magic>magic[1] then
    Flag=1
    elsif magic<magic[1]then
    flag=0
    endif 
    
    if NOT OnMarket and magic>magic[1] and flag<>flag[1] then
    Buy 1 contract at Market
    Set Stop Price Low[1]
    EndIf
     
    If NOT OnMarket and magic<magic[1]and flag<>flag[1] then
    SellShort 1 contract at Market
    Set Stop Price High[1]
    endif
     
    If OnMarket and BarIndex-TradeIndex(1)>NumberOfBars then
    Sell at Market
    ExitShort at Market
    EndIf
    #236628 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    Quando si mette uno STOP su un minimo o massimo della candela precedente, è bene assicurarsi che il minimo sia inferiore a quello attuale o che il massimo sia superiore a quello attuale. Ti consiglio di sostituire le righe 31 e 36 con queste:
    Set Stop Price lowest[2](Low)
    Set Stop Price highest[2](High)
    in questo modo mette lo stop sul minimo più basso o sul massimo più alto delle ultime due candele (quella attuale e quella precedente).
Viewing 4 posts - 1 through 4 (of 4 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

STRATEGIA CON ALPHATREND


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Gaspare @gaspare Participant
Summary

This topic contains 3 replies,
has 4 voices, and was last updated by robertogozzirobertogozzi
2 years, 1 month ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 08/21/2024
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...