ancora sui pivot

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #49434 quote
    Raffaele Grosso
    Participant
    Junior

    chiedo di codificare la seguente strategia:

    entrata short 1 contratto solo se il prezzo incrocia a rialzo il pivot R2

    entrata long 1 contratto solo se il prezzo incrocia a ribasso il pivot S2

    profit 10 punti

    stop loss 30 punti

    se il sistema va stop

    entrata short 2 contratti solo se il prezzo incrocia a rialzo il pivot R3

    entrata long 2 contratti solo se il prezzo incrocia a ribasso il pivot S3

    profit 10 punti

    stop loss 30 punti

     

    ringrazio anticipatemente

    #49631 quote
    Raffaele Grosso
    Participant
    Junior

    ho provato tanto ma non riesco da solo a codificare:

    per prima cosa non riesco a codificare l’entrata solo sul pivot R2 o S2 oppure  R3 o S3

    #49667 quote
    Nicolas
    Keymaster
    Master

    Quanti commerci possibili ogni giorno per questa strategia?

    #49668 quote
    Raffaele Grosso
    Participant
    Junior

    1 commercio short e uno long

    #49679 quote
    Raffaele Grosso
    Participant
    Junior

    su entrambi i pivot

    #49682 quote
    Nicolas
    Keymaster
    Master

    Penso che questo codice dovrebbe funzionare correttamente per la tua strategia.

    defparam cumulateorders=false
    
    //Pivot calculation method
    dailyPivot = (DHigh(1) + DLow(1) + DClose(1)) / 3
    dailyR1 = 2*dailyPivot - DLow(1)
    dailyS1 = 2*dailyPivot - DHigh(1)
    dailyR2 = dailyPivot + (DHigh(1) - DLow(1))
    dailyS2 = dailyPivot - (DHigh(1) - DLow(1))
    dailyR3 = dailyR1 + (DHigh(1) - DLow(1))
    dailyS3 = dailyS1 - (DHigh(1) - DLow(1))
    
    if intradaybarindex=0 then 
    traded=0
    endif
    
    while traded=0 and not onmarket do
    if close<dailyR2 then
    sellshort 1 contract at dailyR2 limit
    endif
    if close>dailyS2 then 
    buy 1 contract at dailyS2 limit 
    endif
    wend 
     
    if traded=0 and onmarket then 
    traded=1
    endif
    
    while traded=1 and not onmarket do 
    if close<dailyR3 then 
    sellshort 2 contract at dailyR3 limit 
    endif
    if close>dailyS3 then 
    buy 2 contract at dailyS3 limit
    endif
    wend
    
    if traded=1 and onmarket then
    traded=2
    endif
    
    set target pprofit 10
    set stop ploss 30
    #49697 quote
    Raffaele Grosso
    Participant
    Junior

    grazie Nicolas sei gentilissimo e grande

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

ancora sui pivot


ProOrder: Trading Automatico & Backtesting

New Reply
Author
Summary

This topic contains 6 replies,
has 2 voices, and was last updated by Raffaele Grosso
8 years, 3 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 10/15/2017
Status: Active
Attachments: No files
Logo Logo
Loading...