Backtest strategia in base al prezzo

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #118078 quote
    giustimgiustim
    Participant
    Junior

    Buonasera

    E’ possibile, con timeframe giornaliero, simulare una strategia che esegua un buy solo se il prezzo è maggiore del massimo del giorno precedente?

    Non sono riuscito a capire se è possibile farla.

    Grazie mille

    #118086 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Eccola:

    Buy 1 contract at Dhigh(1) Stop
    giustim thanked this post
    #118100 quote
    giustimgiustim
    Participant
    Junior

    grazie mille per la risposta

    A me però sembra sempre non funzioni, cosa sbaglio?

    Non vorrei fosse un problema del TF a 1 giorno?

    Parte sempre l’acquisto al prezzo di apertura della barra successiva al verificarsi delle mie condizioni

    DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
    
    ONCE a = PERIODODONCHIAN
    
    
    // definizione indicatori
    mediadonch = DonchianChannelCenter[a]
    emaveloce = ExponentialAverage[PRDEMAFAST](close)
    emalenta = ExponentialAverage[PRDEMASLOW](close)
    
    massimo=high
    minimo=low
    chiusura=close
    apertura=open
    // definizione condizioni
    C1=chiusura CROSSES OVER mediadonch
    E1=emaveloce CROSSES OVER emalenta
    
    C2=chiusura[1]CROSSES UNDER mediadonch
    E2=emaveloce[1]CROSSES UNDER emalenta
    
    // apertura long
    If C1 AND E1 AND apertura<chiusura then
    BUY 1 contract at Dhigh(1) Stop
    ENDIF
    
    // chiusura long
    If C2 and LONGONMARKET THEN
    SELL AT MARKET
    ENDIF
    
    // apertura short
    If C2 AND E2 AND apertura>chiusura THEN
    SELLSHORT 1 contract at Dlow(1) Stop
    ENDIF
    
    
    // chiusura short
    If C1 and SHORTONMARKET THEN
    EXITSHORT AT MARKET
    ENDIF
    #118102 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Prova a sostituire (1) con (0):

    Buy 1 contract at Dhigh(0) Stop
    #118131 quote
    giustimgiustim
    Participant
    Junior

    Niente, il risultato non cambia, l’ordine parte con l’acquisto (o vendita, se short)  al prezzo di apertura della barra successiva al verificarsi delle mie condizioni

    🙁

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

Backtest strategia in base al prezzo


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
giustim @giustim Participant
Summary

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

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 01/27/2020
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...