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
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
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
Effettivmente è un comportamento anomalo.
Nicolas ha chiesto delucidazioni a ProRealTime, ti faremo sapere cosa diranno dopo che avranno investigato bene sulle cause.
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.