After Sold 2 lots, I want to Buy 1 lot as primary target for commodity future. I have made condition as shown in above image.
the code is
( tt_get_var ( tt_get_future_instrument ( ‘Crudeoil’ ) , ‘LTP’ ) <= ( tt_get_runtime ( ‘strategy_id’, ‘Crudeoil’, ‘EntryPrice’ ) - get_runtime ( ‘strategy_id’, ‘run_counter’, ‘vprimary’ ) ) )
I get the runtime value of variable “vprimary” from tradingview and compare it with LTP.
But it is not working properly.
Can anyone tell me the change in condition.
Tradetron TeamTradetron team
Two likely problems in the code:
get_runtime(...) is missing the tt_ prefix used by the other functions. In the builder, use the Get Runtime keyword instead of typing the wire form.
Get Runtime returns a string. For maths (EntryPrice minus your variable) use Get Runtime Number, which returns a number.
So the condition should read: LTP(future) <= EntryPrice - Get Runtime Number('vprimary').
Also check:
The variable must be written before it is read. An unset variable comes back as None and can error.
Repair Once fires only once until a set exit or Universal Exit.
For the target, buy 1 lot back in the Repair Once leg.
Check the Notification Log to see what the condition evaluated to, and test in Live Offline. Keyword docs: Keyword Documentation — Tradetron
Answer written with AI from Tradetron docs (Oct 2026). Original replies are kept above. Spot something wrong? Reply below.