trading intra

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #160570 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    è possibile scrivere un codice che compri un contratto all’open di una candela oraria (esempio 10:00) e chiuda al close della giornata o al close di una ora (esempio 17:00)? Grazie

    #160582 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Eccolo:

    If OpenTime = 080000 and not OnMarket Then
       Buy 1 contract at Market
    Endif
    If OpenTime = 170000 and LongOnMarket then
       Sell at Market
    Endif
    Gabriele Battista thanked this post
    #160978 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    ho notato che se lo lancio su m10 apre le posizioni alle 8:10 se lo lancio su h1 apre le posizioni alle 9:00. quindi dipende dal time frame?

    se volessi entrare long se il prezzo è superiore alla media tra massimo e minimo della giornata precedente, viceversa entrare short, restando sempre la chiusura delle operazioni all’open delle 17:00, come si modificherebbe?

    scusa dovevo fare un altro topic?

    #160979 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    OpenTime è l’ora di apertura della candela, sostituiscilo con Time che è l’ora di chiusura.

    Il post può andare bene qui, è sempre attinente al trading intra.

    Eccolo:

    PrezzoMedio = (Dhigh(1) + Dlow(1)) / 2
    If Close > PrezzoMedio Then
       Buy 1 contract at Market
    Elsif Close < PrezzoMedio Then
       Sellshort 1 contract at Market
    Endif
    If OpenTime = 170000 and OnMarket then
       Sell      at Market
       Exitshort at Market
    Endif
    #161046 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    ciao ho messo insieme i codici perchè nel tuo secondo non c’era più l’orario di ingresso ma il risultato è che compra solo in apertura e non vende mai anche se il prezzo è sotto la soglia. ti allego il codice che ho utilizzato per essere sicuro di non aver fatto errori nell’incollare..

    PrezzoSoglia=(dhigh(1)+dlow(1))/2
    If Time = 080000 and not OnMarket Then
    if close>= PrezzoSoglia then
    Buy 1 contract at Market
    elsif close< PrezzoSoglia then
    Sell 1 contract at Market
    Endif
    endif
    If Time = 170000 and LongOnMarket then
    Sell at Market
    elsif Time = 170000 and ShortOnMarket then
    buy at Market
    Endif
    
    #161166 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Credo che tu faccia confusione con le varie istruzioni di acquisto/vendita:

    • BUY                apre una posizione Long (prima ne chiude una Short,  se aperta)
    • SELL               chiude una posizione Long
    • SELLSHORT apre una posizione Short (prima ne chiude una Long, se aperta)
    • EXITSHORT chiude una posizione Short
    #161223 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    Grazie sono una capra!

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

trading intra


ProOrder: Trading Automatico & Backtesting

New Reply
Summary

This topic contains 6 replies,
has 2 voices, and was last updated by Gabriele BattistaGabriele Battista
5 years, 8 months ago.

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