help once var

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #237503 quote
    carloernestorossi
    Participant
    New

    buongiorno,

    forse  qualcuno può aiutarmi a capire cosa non va   in questo script un po banale forse ma non capisco.

    Semplicemente deve aprire un ordine in compera ma non fa  nulla

    once OrderOnStart = 1

    IF NOT LongOnMarket and OrderOnStart = 1 THEN
    BUY 1 CONTRACTS AT MARKET
    OrderOnStart = 2
    print(OrderOnStart)

    endif

    #237508 quote
    Iván González
    Moderator
    Master

    Prueba esto:

    once OrderOnStart = 1
    
    IF NOT LongOnMarket and OrderOnStart = 1 THEN
    BUY 1 CONTRACTS AT MARKET
    endif
    
    if onmarket then
    OrderOnStart = 2
    endif
    
    if onmarket and yourconditions then
    sell at market
    OrderOnStart = 1
    endif
    
    graph OrderOnStart
    robertogozzi thanked this post
    #237512 quote
    carloernestorossi
    Participant
    New

    il mio script è piu semplice ma  non funziona ma non capisco perchè

    all’avvio dello script non ho posizioni long a mercato e la mia variabile è gia settata a 1 (OrderOnStart = 1)

    nonostante  l’evidenza non entra nella condizione.

    once OrderOnStart = 1

    IF NOT LongOnMarket and OrderOnStart = 1 THEN
    BUY 1 CONTRACTS AT MARKET
    OrderOnStart = 2
    print(OrderOnStart)
    endif

    #237522 quote
    robertogozzi
    Moderator
    Master

    Effettivmente è un comportamento anomalo.

    Nicolas ha chiesto delucidazioni a ProRealTime, ti faremo sapere cosa diranno dopo che avranno investigato bene sulle cause.

    #237523 quote
    robertogozzi
    Moderator
    Master

    In attesa di chiarimenti, Nicolas ha proposto suesta versione funzionante:

    once OrderOnStart = 1
    IF NOT LongOnMarket and OrderOnStart = 1 and islastbarupdate THEN
       BUY 1 CONTRACT AT MARKET
       OrderOnStart = 2
       print(OrderOnStart)
    endif

    grazie all’uso di IsLastBarUpdate.

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

help once var


ProOrder: Trading Automatico & Backtesting

New Reply
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by robertogozzi
1 year, 5 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 09/11/2024
Status: Active
Attachments: No files
Logo Logo
Loading...