Stop&Reverse

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

    Buongiorno, volevo sapere se è possibile codificare uno stop&reverse in un sistema di trading: praticamente se sono long e mi viene raggiunto lo stop loss, vorrei ribaltare la posizione, cioè aprire una posizione short con nuovo stop loss sopra il max della barra precedente.

    Grazie

    #5275 quote
    NicolasNicolas
    Keymaster
    Legend

    Ciao, questo è possibile, ma deve essere in grado di inserire nel codice. Grazie a postare qui, così posso farlo!

    #5293 quote
    FlavioFlavio
    Participant
    New

    In allegato il file con il mio codice: sono abbastanza pratico di programmazione, se mi manda il codice per fare lo Stop&Reverse penso di essere in grado di inserirlo.

    Grazie

    USD.itf
    #5299 quote
    NicolasNicolas
    Keymaster
    Legend

    Prima di tutto dobbiamo creare una variabile che ci dice che tipo era l’ultimo commercio: “buy” (positiontype=1)  o “sell” (positiontype=-1) :

    IF filterL1 and NOT ONMARKET THEN
     ampiezza=((sup-inf)/(1*Ticksize))*var1
     ampiezzaP=((sup-inf)/(1*Ticksize))*var2
     BUY ncontratti CONTRACTS AT sup STOP
     positiontype = 1
    ENDIF

    Quindi verificare se l’ultimo commercio stava perdendo e non vi è alcun commercio nel mercato. E l’invio di un ordine inverso.

    IF NOT ONMARKET THEN
     IF POSITIONPERF(1)<0 AND positiontype=1 THEN
       SELLSHORT ncontratti AT MARKET
     ENDIF
    ENDIF
    

    È che va bene?

    #5300 quote
    FlavioFlavio
    Participant
    New

    Ok, appena ho tempo proverò a inserire il codice per vedere se funziona; per intanto La ringrazio.

    Flavio F.

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

Stop&Reverse


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Flavio @ruoston Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by FlavioFlavio
10 years, 5 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 04/11/2016
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...