Creazione semplificata

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #74958 quote
    ironshirowironshirow
    Participant
    Average

    Ciao,

    per fare esercizio sto utilizzando la creazione semplificata ma non riesco a realizzare due cose semplici:

    1. chiudere la posizione in qualsiasi situazione al termine della candela o al massimo all’apertura della candela successiva;
    2. Usando il parabolic sar eseguire un ordine per ogni trend e non tutte le volte che le condizioni esistono anche se il trend è il medesimo.

    Grazie a chi mi potrà aiutare.

    Ciao

    #75060 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Non credo si possa fare con la creazione assistita, quella è un aiuto per cose estrememente semplici.

    Quanto al punti 1 basta che metti, all’inizio della tua strategia (dopo gli aventuali DEFPARAM):

    IF OnMarket THEN       //non fare distinzioni tra Long e Short
       EXITSHORT AT MARKET //chiudere gli Short, se ve ne sono aperti
       SELL      AT MARKET //chiudere i   Long,  se ve ne sono aperti
    ENDIF

    Per il punto 2 devi usare due variabili, una per ogni trend (Up o Down) ed abilitare il trading solo al cambio (non l’ho testato):

    ONCE TrendUP = 0                   //1=trend al rialzo
    ONCE TrendDN = 0                   //1=trend al ribasso
    MySAR        = SAR[0.02,0.02,0.2]
    IF close > MySar AND TrendUP = 0 AND Not OnMarket THEN
       BUY 1 CONTRACT AT MARKET
       TradeUP = 1                    //segnalare che il Trend è al rialzo...
       TradeDN = 0                    //... non al ribasso
    ENDIF
    IF close < MySar AND TrendDN = 0 AND Not OnMarket THEN
       BUY 1 CONTRACT AT MARKET
       TradeDN = 1                    //segnalare che il Trend è al ribasso...
       TradeUP = 0                    //... non al rialzo
    ENDIF

    Combinando insieme i due esempi avrai una sola entrata a mercato per ogni trend e le operazioni verranno chiuse, indistintamente se long o short o se in profitto o perdita, dopo una sola barra:

    ONCE TrendUP = 0                   //1=trend al rialzo
    ONCE TrendDN = 0                   //1=trend al ribasso
    IF OnMarket THEN                   //non fare distinzioni tra Long e Short
       EXITSHORT AT MARKET             //chiudere gli Short, se ve ne sono aperti
       SELL AT MARKET                  //chiudere i Long, se ve ne sono aperti
    ENDIF
    MySAR        = SAR[0.02,0.02,0.2]
    IF close > MySar AND TrendUP = 0 AND Not OnMarket THEN
       BUY 1 CONTRACT AT MARKET
       TradeUP = 1                    //segnalare che il Trend è al rialzo...
       TradeDN = 0                    //... non al ribasso
    ENDIF
    IF close < MySar AND TrendDN = 0 AND Not OnMarket THEN
       BUY 1 CONTRACT AT MARKET
       TradeDN = 1                    //segnalare che il Trend è al ribasso...
       TradeUP = 0                    //... non al rialzo
    ENDIF
    #75201 quote
    ironshirowironshirow
    Participant
    Average

    Ciao,

    mi correggo ho risolto una parte ma ora la simulazione mi da zero operazioni.

    Grazie

    Schermata-2018-07-04-alle-13.11.52.png Schermata-2018-07-04-alle-13.11.52.png
    #75209 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Perché hai allegato quella foto? Se ti segnala quell’errore è perché, come dice chiaramente, non stai usando quelle due variabili, per cui devi commentarle.

    #75228 quote
    ironshirowironshirow
    Participant
    Average

    Ciao,

    ho risolto il problema e quindi ho cambiato il messaggio ma non potevo rimuovere l’allegato.

    Ciao

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

Creazione semplificata


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
ironshirow @ironshirow Participant
Summary

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

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 06/30/2018
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...