Login Page - Create Account

Support Board


Date/Time: Fri, 26 Apr 2024 01:20:19 +0000



order return question

View Count: 1070

[2017-01-18 05:55:59]
User103949 - Posts: 78
I place an order using the following code in a backtesting mode.

s_SCNewOrder entryOrder;
entryOrder.OrderQuantity = 1;
entryOrder.OrderType = SCT_ORDERTYPE_MARKET;
entryOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED;
entryResult = sc.SellEntry(entryOrder, index);

my return value for entryResult is -8998. What is the potential cause for that?

Thanks,
[2017-01-18 06:44:20]
Sierra Chart Engineering - Posts: 104368
Refer to the Order Error Constants here:
Automated Trading From an Advanced Custom Study: Order Error Constants
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2017-01-19 04:25:32]
User103949 - Posts: 78
I figured out that all the trades are skipped either because SCT_SKIPPED_DOWNLOADING_HISTORICAL_DATA or SCT_SKIPPED_FULL_RECALC.

My question is how do I backtest my strategy if all the trades are skipped during a full recalculation?
[2017-01-19 05:03:58]
Sierra Chart Engineering - Posts: 104368
For back testing you need to follow the documented procedures on this page:

Auto Trade System Back Testing
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2017-01-19 05:10:52]
User103949 - Posts: 78
I did follow the documentation. As i mentioned above, I created a study of customed bar and my strategy was based on that. As i click replay, i could see in debug mode that my order was ignored either due to historical data download or full recalculation
of my study. Is there a way to get around that to see historical performance of my strategy?
[2017-01-19 05:36:29]
Sierra Chart Engineering - Posts: 104368
During the initial full recalculation, the order actions will be ignored but as a chart is replaying, this will not be the case.

Continue to monitor the return values and you will see what we say is correct.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2017-01-19 13:53:34]
User103949 - Posts: 78
I noticed that the order will be triggerred on the right most bar if there is a signal. Can the replay start at the very first bar on the left?
[2017-01-19 18:13:45]
Sierra Chart Engineering - Posts: 104368
The only way to do this is to use this command:
http://www.sierrachart.com/index.php?page=doc/TradeMenu.html#AutoTradeSystemReplayBacktest

Or you could load an additional day of data into the Intraday chart and then scroll the chart so the bar that you want to start the replay at is at the rightmost bar in the visible chart.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2017-01-20 02:48:29]
User103949 - Posts: 78
I don't understand how i can make it work through the link you provided. It was still skipping all the traders as before. Can you be more specific?

http://www.sierrachart.com/index.php?page=doc/TradeMenu.html#AutoTradeSystemReplayBacktest

Load additional data might work but it is not ideal.

I want to be more specific on what i am doing here such that you can better help me. I created a study which were doing the following two things at the same time:
1. create my own bar based on some rules
2. generate trading signals based on the bar created in step on and then place trades

I tried both Auto trade replay backtest and replay chart. Both were skipping most of the trades except on the right most bar.

Thanks,
Date Time Of Last Edit: 2017-01-20 03:12:59
[2017-01-20 03:27:03]
Sierra Chart Engineering - Posts: 104368
The link we gave, then links to this page:
http://www.sierrachart.com/index.php?page=doc/Backtesting.php

Here are the specific instructions:
http://www.sierrachart.com/index.php?page=doc/Backtesting.php#ReplayBackTestingAutomatic

It was still skipping all the traders as before.
This cannot possibly be the case. There will be a full recalculation of the chart but that would only be at the very first bar. Once there is another bar added during the replay, then the orders are not going to be ignored due to a full recalculation. This is just not possible. The way you are analyzing this must not be correct.

For proof, just simply follow through the instructions here and test one of the trading systems provided by Sierra Chart. Follow through the instructions in this section here:
http://www.sierrachart.com/index.php?page=doc/ACSILTrading.html#ExampleCode

Try the trading system Trading Example: Using Reversals.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2017-01-20 03:59:53]
User103949 - Posts: 78
Thanks,

I tested trading example using reversal and it worked on a tick level bar with 1 day history.

I noticed that the reversal strategy applied on original tick bar. There was some difference from what i was doing here.
My study is creating a custom bar based on original tick bar first, and all trading signals are based on custom bars not original tick bar.

Will that make a difference?
I am wondering if i need to create another study for trade only separate from the study for creating the custom bar?
[2017-01-20 05:20:27]
Sierra Chart Engineering - Posts: 104368

My study is creating a custom bar based on original tick bar first, and all trading signals are based on custom bars not original tick bar.
The problem must be related to this. Although not sure why at this point.

Try using the Point and Figure study and run your automated trading system on that and see if it works. That study also creates its own custom bars.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2017-01-20 05:47:57]
User103949 - Posts: 78
It seems you misunderstood what i said. Applying my study to other custom bar does not make sense because in my study it's already creating some custom bar based on raw tick data only.

I tried the following and it worked. First I applied study of Renko chart from the study list provided by SC. Then I applied trading using reversal study and it worked for backtesting.

In my study I could not separate creating the custom bar and generating trading signals since all the code are mixed and they are dependent.

Hopefully you can help.

Thanks,
[2017-01-20 06:18:59]
Sierra Chart Engineering - Posts: 104368
Applying my study to other custom bar does not make sense because in my study it's already creating some custom bar based on raw tick data only.
Yes we understand this, but we just want to get an understanding of the underlying reason for the issue.

I am wondering if i need to create another study for trade only separate from the study for creating the custom bar?
We did not pay close enough attention to this. Yes, you absolutely need to do this and this is the reason why there is a problem currently.

You need to find a way to separate them. Studies can work with each other by referencing data between each other. There are a couple of ways of doing this.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2017-01-20 06:21:08
[2017-01-20 06:21:17]
Sierra Chart Engineering - Posts: 104368
The prior post has been updated.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account