Support Board
Date/Time: Thu, 06 Feb 2025 19:11:58 +0000
[Programming Help] - Automated Trading From an Advanced Custom Study
View Count: 1106
[2020-05-02 16:05:22] |
User783475 - Posts: 12 |
Hi, I don't know if you can help me. I made an advanced custom study to select specific bars in a chart and it's ok, it works, but now I tried to add a part of code to implement an automatic trade. I followed the instructions that are exposed in your "Automated Trading From an Advanced Custom Study" section, but every time that my TargetBar occurs, and so it should be sended an order, appear the log message "Order entry skipped because full recalculation" and I found that it's because when my TargetBar appears the study is still calculating, but then, how can I do? I have Auto-loop set to false, sc.AllowMultipleEntriesInSameDirection = true; sc.MaximumPositionAllowed = 10; sc.SupportReversals = false; sc.SendOrdersToTradeService = false; sc.AllowOppositeEntryWithOpposingPositionOrOrders = false; sc.SupportAttachedOrdersForTrading = true; sc.TradeWindowConfigFileName = "Test_2.twconfig"; sc.CancelAllOrdersOnEntriesAndReversals= false; sc.AllowEntryWithWorkingOrders = false; sc.CancelAllWorkingOrdersOnExit = true; sc.AllowOnlyOneTradePerBar = true; sc.MaintainTradeStatisticsAndTradesData = true; and I use fuctions like this s_SCNewOrder NewOrder; NewOrder.OrderQuantity = 1; NewOrder.OrderType = SCT_ORDERTYPE_LIMIT; NewOrder.TimeInForce = SCT_TIF_DAY; int retvalue = (int)sc.BuyEntry (NewOrder, i); where i is a counter variabile in a loop and if I print retvalue, it always is -8998 Trade simulation mode is ON I updated SC to the last version. Please help me to figure out what I'm doing wrong |
[2020-05-03 00:31:30] |
User701453 - Posts: 176 |
Have you looked at the example code located in the "\ACS_Source" folder?
|
[2020-05-03 14:10:22] |
User783475 - Posts: 12 |
yes I have, and I tried to closely follow its code...
|
[2020-05-03 14:29:03] |
Merlin - Posts: 83 |
Are you testing your system on incoming data (either live or delayed), or in a replay? It sounds as though you're simply opening a chart, and expecting it to show you all the places a trade would have been taken with your automated system. That's not how it works - take a look at Auto Trade System Back Testing |
[2020-05-04 15:06:44] |
User783475 - Posts: 12 |
I'm not so sure I understand well what are you saying... I can see the bars while they're are forming, when the last is not closed yet. So i think that is what is intended with incoming data (and it's delayed of 5 minutes).
|
To post a message in this thread, you need to log in with your Sierra Chart account: