Breakout su massimo/minimo ultime 15 barre in un certo orario

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #232190 quote
    banjoo78banjoo78
    Participant
    New

    Ciao, sto cercando di realizzare un sistema che, ogni giorno alle 14:00, verifichi le 15 barre precedenti per trovare il MAX HIGH e MIN LOW e utilizzarli come livelli di breakout.

    Il sistema deve chiudere tutte le posizioni alle 23:00

    Il codice che posto qui di seguito non esegue nulla… qualcuno saprebbe aiutarmi? grazie mille

    Fabio

    
    EnterTime = 140000
    ExitTime = 230000
    
    SetTP = 0
    SetSL = 0
    VarTP = 100000
    VarSL = 100000
    
    IF  Time = EnterTime THEN
    
    Hi = highest[15](High)
    Lo = lowest[15](Low)
    
    IF CLOSE > Hi THEN
    BUY 1 CONTRACT AT MARKET
    
    ELSIF close < Lo THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    ENDIF
    
    IF LONGONMARKET AND TIME = ExitTime THEN
    SELL 1 CONTRACT AT MARKET
    ENDIF
    
    IF SHORTONMARKET AND TIME = ExitTime THEN
    EXITSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    IF SetTP = 1 Then
    SET TARGET PPROFIT varTP
    endif
    
    IF SETSL = 1 Then
    SET STOP PLOSS varSL
    endif
    #232191 quote
    phoentzsphoentzs
    Participant
    Master
    
    IF CLOSE > Hi(1) THEN
    BUY 1 CONTRACT AT MARKET
     
    ELSIF close < Lo(1) THEN
    SELLSHORT 1 CONTRACT AT MARKET
    #232192 quote
    banjoo78banjoo78
    Participant
    New

    Ciao, grazie mille per la risposta.

    Però non capisco: HI e LO non dovrebbero già contenere i valori di massimo e minimo degli ultimi 15 giorni? Perchè devo inserire anche (1)?

    Grazie

    Fabio

    #232193 quote
    phoentzsphoentzs
    Participant
    Master

    Perché l’Hi e Lo in esame si riferiscono alle 15 candele precedenti e il periodo di osservazione non termina con la candela attuale ma con quella precedente.

    banjoo78 thanked this post
    #232198 quote
    Iván GonzálezIván González
    Moderator
    Legend

    Ciao Il sistema non fa nulla perché l'espressione close > highest[15](High) non sarà mai soddisfatta poiché è impossibile che il prezzo di chiusura superi il massimo delle ultime 15 barre compresa quella corrente. Per questo motivo phoentzs ti dice close > Hi[1] in modo che cerchi il massimo delle 15 candele precedenti a quella attuale. Spero di essermi spiegato. Partendo dal tuo codice, ti lascio qui un codice che può servirti da guida:

    defparam cumulateorders = false
    EnterTime = 140000
    ExitTime = 230000
    
    SetTP = 0
    SetSL = 0
    VarTP = 100000
    VarSL = 100000
    
    IF Time = EnterTime THEN
    Hi = highest[15](High)
    Lo = lowest[15](Low)
    endif
    
    //-----Long
    IF not onmarket and CLOSE > Hi[1] and time > EnterTime and time < Exittime THEN
    BUY 1 CONTRACT AT MARKET
    endif
    IF LONGONMARKET AND TIME >= ExitTime THEN
    SELL AT MARKET
    ENDIF
    //-----Short 
    IF not onmarket and close < Lo[1] and time > EnterTime and time < Exittime THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    IF SHORTONMARKET AND TIME >= ExitTime THEN
    EXITSHORT AT MARKET
    ENDIF
    
    graphonprice Hi coloured("blue")
    graphonprice Lo coloured("red")
    banjoo78 thanked this post
    #232202 quote
    banjoo78banjoo78
    Participant
    New

    Grazie mille!!! Chiarissimo!

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

Breakout su massimo/minimo ultime 15 barre in un certo orario


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
banjoo78 @banjoo78 Participant
Summary

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

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 05/02/2024
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...