trading system 1 min

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #24978 quote
    Max
    Participant
    Average

    Qui di seguito una domanda inviata a ProRealTime :

     

    Faccio seguito alla richiesta su cui mi avete già aiutato e per questo vi ringrazio.

    Time Frame 1 minuto

    Inidividuazione del max e min tra due orari (1530_2200)

    Alle 2201 voglio entrare long se il close della candela corrente > del minimo individuato con la precedente routine e short se il close della candela corrente < del massimo individuato con la precedente routine. Chiusura della posizione alle 2210 o posso aggiungere target. Ho provato a programmare ma entra sempre long e short contemporaneamente e non capisco dove commetto l’errore. Il sistema dovrebbe entrare alle 2201 o long o short e non in entrambe le direzioni sulla base della condizione impostata.

    DefParam CumulateOrders=false
    defparam flatbefore=220100
    defparam flatafter=221000
    
    starttime=153000
    endtime=220000
    
    timetotrade=220100
    if opentime=starttime or (opentime > starttime and opentime[1] < starttime) then
    mymax=high
    mymin=low
    elsif opentime> starttime and time <=endtime then
    mymax=max(high,mymax)
    mymin=min(low,mymin)
    endif
    
    if  not shortonmarket and time = timetotrade and close < mymax then
    sellshort 1 share at market
    endif
    if not longonmarket and  time = timetotrade and close > mymin then
    buy 1 share at market
    endif

     

     

     E un esempio di risposta :

    defparam flatbefore=220100
    defparam flatafter=221000
    
    starttime=153000
    endtime=220000
    
    timetotrade=220100
    if opentime=starttime or (opentime > starttime and opentime[1] < starttime) then
    mymax=high
    mymin=low
    elsif opentime> starttime and time <=endtime then
    mymax=max(high,mymax)
    mymin=min(low,mymin)
    endif
    
    if time = timetotrade then
    if close > low[1] then
    buy 1 share at market
    sell at mymin stop
    sell at mymax limit
    elsif close < high[1] then
    sellshort 1 share at market
    exitshort at mymin limit
    exitshort at mymax stop
    endif
    endif
    
    if longonmarket then
    sell at mymin stop
    sell at mymax limit
    endif
    if shortonmarket then
    exitshort at mymin limit
    exitshort at mymax stop
    endif
    #25069 quote
    Silvia Brugnolaro
    Participant
    Veteran

    L’errore sta sulle tue condizioni “Alle 2201 voglio entrare long se il close della candela corrente > del minimo individuato con la precedente routine e short se il close della candela corrente < del massimo individuato con la precedente routine.”

    Se la chiusura della candela delle 2201 sta tra il max e il min del pomeriggio (1530-2200) soddisfa entrambi le condizioni di entrata e quindi partono a mercato sia l’ordine short che quello long

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

trading system 1 min


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Max @max Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Silvia Brugnolaro
8 years, 12 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 02/13/2017
Status: Active
Attachments: No files
Logo Logo
Loading...