Buy above open.


Category:
0
0

Hello Pete

I had a question on Dailyopen() study, when I included that in a conditional order it shows where the entries are, but when I included that in an order, it doesn’t get executed.

Attached is the chart showing order.

Is there is any way to buy the stock when it goes above the today’s open price of day on 1 minute time period.

Here is the code for dailyopen()

input aggregationPeriod = AggregationPeriod.DAY;
input showOnlyLastPeriod = yes;

def prevPrice = open(period = aggregationPeriod)[-1];
def price = open(period = aggregationPeriod);
plot DailyOpen = if showOnlyLastPeriod and !IsNaN(prevPrice) then Double.NaN else price;

DailyOpen.SetDefaultColor(GetColor(2));
DailyOpen.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

Attachments:
Marked as spam
Posted by (Questions: 9, Answers: 8)
Asked on January 22, 2021 1:05 pm
134 views
0
Private answer

Since you are working with a Conditional Order and not a chart study I have moved this post into the "Strategy Guide" topic.

The only other way I can think to do this is to use recursive variables. Which are not supported in Condition Orders.

I suggest you set the time frame of the conditional order and try the following in place of the solution you have already tried:

plot trigger = close > open;

Yes it will still work intraday. Yes it will trigger as soon as the current price is greater than the current trading session open. The 1 min time frame in this case does NOT cause the code to be more responsive or react more quickly. This is a common misconception of how the language of Thinkorswim functions.

Marked as spam
Posted by (Questions: 37, Answers: 4084)
Answered on January 22, 2021 1:28 pm
0
Hello Pete How would the code be written. Since the code that I pasted earlier it was a Study that was provided in TOS study list, its called DailyOpen I have no idea what the code does in that study. Also when I just change the plot statement I got too many entries, even below the open. Below is the code that I placed in the conditional order and it showed lots of green uptics. input aggregationPeriod = AggregationPeriod.DAY; input showOnlyLastPeriod = yes; def prevPrice = open(period = aggregationPeriod)[-1]; def price = open(period = aggregationPeriod); plot trigger = close > open; Can you let me know the code that I can attach to the order and try it out to see if it works. Thanks.
( at January 22, 2021 7:20 pm)
0
"how would this code be written" Exactly has I provided it. One line of code. Time frame set to daily.
( at January 23, 2021 10:50 am)