Buy if current ask if higher than previous bar High


Category:
0
0

Hello Pete

I’m new to TOS platform,  Saw your web site, very nicely put together.  I don’t have much programming experience, i was able to write this one line code with help of the strategy builder, there seems to be something wrong with the code since the order just keep following the ask but doesn’t gets executed, attached are the screen capture.

 

Thanks.

 

 

Attachments:
Marked as spam
Posted by (Questions: 2, Answers: 2)
Asked on April 26, 2018 6:58 pm
312 views
0
Private answer

Greater than close from -1 is a problem. Not sure it is “the” problem. But it is certainly a problem that needs to be corrected.

There are actually two problems. First, your question’s title says “Buy if current ask if higher than previous bar High”. So you really don’t want to use the close here, do you? That should be the high. Second, the phrase from -1 has no interpretation in Thinkscript. It’s like speaking a foreign language. One way to express this so it is in compliance with your stated goal is to use from 1 bar ago. The minus One actually would look into the future, if it were employed correctly. So that is certainly NOT what you want.

So I would suggest: ask is greater than high from 1 bar ago

Notice I have left out the parentheses following the word ask. They are not required: http://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Fundamentals/ask.html

However when building this with the condition wizard the parentheses are added. So it works either way. See screenshot below for how this would be build using the condition wizard.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on April 26, 2018 8:06 pm
0
Private answer

Hello Pete

Thanks for the quick reply, today i test out this on the paper trade side of TOS, and something strange i happening, its just executes the order right way and doesn’t wait for the current ask to go higher than the previous bar high. Attached is the screen capture.

Thanks.

Attachments:
Marked as spam
Posted by (Questions: 2, Answers: 2)
Answered on April 27, 2018 11:54 am
0

Typically we do not permit “new answers” to be posted unless the user is providing a new or improved solution to the posted question. But in this case your screenshots provide a very crucial piece of evidence so we will permit it. In the future, please do not use the “Post your Answer” box at the bottom of the thread, instead, use the comment link as I have done here.

Now on to your issue. I notice your chart is set to one minute. I suppose that you are expecting this to somehow impact the time frame applied to your conditional order. It does not. Totally not connected in any way shape or form.

The time frame applied to your conditional order is set in the window in which you build your code. It’s at the very top left corner. Easy enough to miss. Yours is set to Daily. How do I now that? It is revealed within the text of the notification in your first screenshot:

“FILLED BUY +100 MSFT MRKT WHEN MSFT STUDY ‘ask is greater than high from 1 bar ago;D’ IS TRUE [TO OPEN]”

You see the D? That means the time frame for this conditional order was set to Daily. This is why your order executed immediately.

Details, details, details….. must learn to look everywhere for those pesky details.

( at April 27, 2018 12:08 pm)
0

Great, Its works now,

Thanks.!!

( at April 27, 2018 12:31 pm)