Tradare con i livelli del giorno precedente

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #208357 quote
    Stanko
    Participant
    Senior

    Buongiorno Roberto,

    volevo chiederti se cortesemente puoi correggere il seguente codice che non riesco a far funzionare come vorrei.

    La strategia prevederebbe di prendere in considerazione i Massimi e minimi della sessione Usa del giorno precedente (candele orarie da ore 16 a ore 22), con acquisto al valore del Massimo già a partire dalla prima ora del giorno successivo.

    Stesso ragionamento con vendita sul lato short.

    Il codice qui sotto prende spunto da alcuni tuoi suggerimenti.

    Grazie.

    DEFPARAM CumulateOrders = false
    OraChiusura = 220000
    Timeframe(Daily,UpdateOnClose)
    DDhigh = high
    DDlow = low
    Timeframe(1 hours,updateonclose)
    IF OnMarket AND Time = OraChiusura THEN
    SELL AT Market
    EXITSHORT AT Market
    ENDIF
    IF close < DDhigh AND Not LongOnMarket AND Time < OraChiusura
    THEN
    BUY 1 CONTRACT AT DDhigh STOP
    ENDIF
    IF close > DDlow AND Not ShortOnMarket AND Time < OraChiusura
    THEN
    SELLSHORT 1 CONTRACT AT DDlow STOP
    ENDIF
    #208476 quote
    Stanko
    Participant
    Senior

    Ciao Roberto,

    forse ho trovato la soluzione.

    Ho provato ad utilizzare gli Array e gli ingressi mi sembrano precisi.

    Rimane un problema quando si passa dal venerdì al lunedì e si aggiunge la candela della domenica.

    A parte questo potresti per cortesia confermarmi che il programma è impostato bene?

    Grazie

    DEFPARAM CumulateOrders = false
    OraChiusura = 220000
    $ALTO[1] = 0
    $BASSO[1] = 0
    Timeframe(1 hours,UpdateOnClose)
    IF DayofWeek <> 1 then
    IF time >=010000 AND time <=050000 then
    IF time = 010000 then
    $ALTO[1] = (highest[10](high[3]))
    $BASSO[1] = (lowest[10](low[3]))
    IF OnMarket AND Time = OraChiusura THEN
    SELL      AT Market
    EXITSHORT AT Market
    ENDIF
    IF Not OnMarket AND Time < OraChiusura THEN
    BUY 1 CONTRACT AT $ALTO[1] STOP
    ENDIF
    IF Not OnMarket AND Time < OraChiusura THEN
    SELLSHORT 1 CONTRACT AT $BASSO[1] STOP
    ENDIF
    ENDIF
    ENDIF
    ENDIF
    Set Target pProfit 140
    Set Stop pLoss 70
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Tradare con i livelli del giorno precedente


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Stanko @stanko Participant
Summary

This topic contains 1 reply,
has 1 voice, and was last updated by Stanko
3 years ago.

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