help once var

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #237503 quote
    carloernestorossicarloernestorossi
    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álezIván González
    Moderator
    Legend

    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
    carloernestorossicarloernestorossi
    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
    robertogozzirobertogozzi
    Moderator
    Legend

    Effettivmente è un comportamento anomalo.

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

    #237523 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    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.
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

help once var


ProOrder: Trading Automatico & Backtesting

New Reply
Summary

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

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