Support Board
Date/Time: Thu, 06 Feb 2025 19:24:16 +0000
Post From: Automated Trading From an Advanced Custom Study
[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 |