How to wait for the bar closure on Conditional Orders?

rogtrader

Member
I've got a simple question about the conditional orders.. How to wait for the bar to close on conditional orders?

for example, my condition is RSI().RSI > 50 .. the condition meets in the middle of the bar and order gets executed, and condition disappears at the closure of the bar.

How do we wait for the bar closure on bar closures? One idea is that RSI().RSI[1] > 50, but the offset [1] is not working well for the other studies.

Thanks!
 

shiva

New member
Check this - https://tlc.thinkorswim.com/center/reference/thinkScript/Declarations/once-per-bar

once_per_bar Syntax
declare once_per_bar;

Description
Changes the recalculation mode of a study. By default, last study values are recalculated after each tick. If this declaration is applied, the study is forced to recalculate the last values only once per bar. This declaration can be used to reduce CPU usage for studies which do not need to be recalculated per each tick.

Example
declare once_per_bar;
input time = 0930;

AddVerticalLine(secondsFromTime(time)[1] < 0 && secondsFromTime(time) >= 0, time);
This study plots a vertical line between the bars created before and after the specified time in the EST time zone. Since the creation time for bars is fixed, there is no need to recalculate the study after each tick.
 

Chadnash

New member
So how would this exactly be setup within the conditional order entry area? What would be the study and how would we define not to possibly fire until current bar is finished?
 

Similar threads

Top