Add Order Usage


Category:
0
0

Hi,

I have watched the video here https://www.youtube.com/watch?v=YW8ruMckbEw

I am wondering how “addOrder” function works? I tried the following code but it doesn’t create any order :

addOrder(OrderType.BUY_TO_OPEN, true,open[-1],1,Color.RED,Color.RED);

Anyone can help ?

Marked as spam
Posted by (Questions: 2, Answers: 1)
Asked on February 22, 2017 6:24 pm
238 views
0
Private answer

The second argument of your AddOrder() statement is “true”. This is not accepted by the AddOrder() statement. It should generate an error and not permit you to save the Strategy. In it’s place, you should use the word “yes”. This will create a single buy order on the second candle in the viewable data on the chart.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on February 22, 2017 7:19 pm
0
I have changed to ”yes”, still can’t see the order. I added the strategy to price studies and strategies in chart’s edit studies. Anything need to be adjusted ?
( at February 22, 2017 9:13 pm)
0

If you are using that line of code and still not seeing a single buy order at the far left of the viewable chart area (the second candle). Then you must have created a study instead of a strategy. The AddOrder() statement is only active in a strategy. The problem is that Thinkorswim does not throw an error when adding this to a study file. It would be better if they fixed that so you could not even save a study with that line in it.

( at February 23, 2017 8:03 am)
0

I am sure, I have created a strategy. You can see here https://drive.google.com/file/d/0B9OKiREuczg3VjBfa1FRbWtRODA/view?usp=sharing

( at February 24, 2017 1:30 am)
0

Yes, that does appear to be in the Strategies section. I could not see the left side of your chart as it covered by the edit studies window. What is the ticker symbol you are charting and what is the aggregation period?

( at February 24, 2017 8:03 am)
0
You can see the left side of my chart here : https://drive.google.com/file/d/0B9OKiREuczg3RGxJd1FUal9yaVE/view?usp=sharing I am charting on ”/cl”. The aggregation period is 5 minutes.
( at February 26, 2017 6:24 pm)
0

Thanks for the screenshot. You see the scroll bar at the bottom? You are not viewing the far left of the viewable chart data. Scroll all the way until you get to the very first candle in the chart. There you should see your buy order. On the second candle.

( at February 26, 2017 7:50 pm)
0

Is it making the real order ? Because I still have a lot of money in my account.

( at February 27, 2017 12:41 am)
0

No, it is not making the real order. It is not possible to make a real order using the AddOrder() function in a chart based strategy.

( at February 27, 2017 7:57 am)