STRATEGIA DI BREKOUT SULLA SESSIONE PRECEDENTE

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #221475 quote
    PICCI64
    Participant
    New

    Buongiorno

    vorrei creare un treding sistem che si basi sulla semplice regola di entrare in posizione long o short se avviane il brekout del minimo (entrata short)  o del massimo (entrata long) della sessione precedete,

    qualcuno mi può aiutare a creare il codice ?

    Ringrazio anticipatamente chi potrà aiutarmi

    Marcello

    #221476 quote
    robertogozzi
    Moderator
    Master

    Eccolo:

    DEFPARAM CumulateOrders = False
    ONCE SL = 300
    ONCE TP = SL * 3
    IF Not OnMarket THEN
       IF close CROSSES OVER Dhigh(1) THEN
          BUY 1 Contract at Market
       ELSIF close CROSSES UNDER Dlow(1) THEN
          SELLSHORT 1 Contract at Market
       ENDIF
    ENDIF
    SET TARGET pPROFIT TP
    SET STOP   pLOSS   SL
    //graphonprice Dhigh(1) coloured("Green")
    //graphonprice Dlow(1) coloured("Fuchsia")

    Togli le barre dei commenti dalle ultime due righe, se vuoi vedere sul grafico le linee dei due valori della sessione precedente.

    #221485 quote
    PICCI64
    Participant
    New

    Grazie molto per la risposta davvero sollecita

    ho provato a fare dei test la strategia da risultati interessanti soprattutto con time frame sul 4 ore

    o giornaliero, ma le posizioni restano a mercato per tanti giorni (anche 20 25 giorni)  se si volesse

    invece chiuderle entro il giorno successivo all’apertura con TP  e SL più ristretti come si può fare?

    Marcello

    #221521 quote
    robertogozzi
    Moderator
    Master

    Non mi ero accorto che avevi postato nel forum sbagliato. Trattandosi diuna strategia l’ho spostato nel supporto ProOrder.

    Per SL e TP basta che vari le righe 2 e 3, mettendo i valori che ti sono più consoni.

    Riguardo alla chiusura, basta aggiungere, subito dopo la linea 3, queste:

    IF OnMarket AND OpenDay <> OpenDay[1] THEN
       SELL at Market
       EXITSHORT at Market
    ENDIF

    e chiuderà all’inizio del giorno successivo.

    #221526 quote
    phoentzs
    Participant
    Master

    Puoi anche provare quanto segue per utilizzare uno SL o un TP dipendente dalla volatilità.

    area = dhigh(1)-dlow(1) 
    Set target profit area*factor1 
    Set stop loss area*factor1*2
    robertogozzi thanked this post
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

STRATEGIA DI BREKOUT SULLA SESSIONE PRECEDENTE


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
PICCI64 @picci64 Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by phoentzs
2 years, 4 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 09/23/2023
Status: Active
Attachments: No files
Logo Logo
Loading...