Chiusura posizione dopo n barre

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #64194 quote
    Daniele
    Participant
    Average

    Ciao a tutti, questo è il mio primo post. Complimenti per la qualità del forum. Ho tratto moltissimi consigli utili leggendovi.

    Io sto cercando di impostare una strategia con queste caratteristiche

    • uscita dopo N barre dall’ingresso;
    • SL
    • un target price qualora venga raggiunta una certa percentuale prima delle N barre.

    evidentemente sbaglio qualcosa perchè non funziona l’uscita dopo il numero di barre decise

    Vi ringrazio per i contributi e o suggerimenti

     

    Once Barra=0  //attribuisco il valore 0 alla variabile "Barra"
    
    if not onmarket then //attribuisco il valore 0 alla variabile "Barra"quando non in mercato
    Barra=0
    endif
    
    IF CONDIZIONE THEN
    MyLimitBuy=prezzo // viene fissato il prezzo d'ingressso
    Barra = Barindex // viene fissata la variabile alla barra d'ingresso
    ENDIF
    
    
    IF CONDIZIONE then 
    BUY 100 shares AT MyLimitBuy stop
    set target %profit 3
    set stop %loss 2
    ENDIF
    
    iF LONGONMARKET and  BarIndex - MiaBarra = 3 then //forzo la vendita dopo tre barre
    Sell at market
    endif
    
    #64204 quote
    robertogozzi
    Moderator
    Master

    Le righe 1 e 9 puoi toglierle (oppure le commenti).

    La riga 19 sostituiscila con

    iF LONGONMARKET and  (BarIndex - TradeIndex) = 3 then //forzo la vendita dopo tre barre
    Nicolas thanked this post
    #64312 quote
    Daniele
    Participant
    Average

    Grazie

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

Chiusura posizione dopo n barre


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Daniele @daniele Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Daniele
7 years, 11 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 03/01/2018
Status: Active
Attachments: No files
Logo Logo
Loading...