Support Board
Date/Time: Fri, 31 Oct 2025 17:44:00 +0000
Post From: How to trade a different security from chart
| [2017-06-08 06:34:25] | 
| User972044 - Posts: 154 | 
| Well I NEVER had to do that.  I NEVER had to use a for loop to go through all the the whole array just to send orders when sc.Autoloop = 0.  sc.Index has always just incremented by 1 all by itself throughout the program.  I have always enclosed all the codes in the if (sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED) {} section and it would just send all the orders both in backtesting and live.  Even your own documentation stated "sc.Index initially starts at 0 and increments up to sc.ArraySize -1 when the study is fully recalculated" in the section for sc.Autoloop = 0.  And all of the study function value at each sc.Index value are ALL correct e.g. Stochastic[sc.Index] and Stochastic[sc.Index -1] all returned correct values at each bar but sc.Index just don't get incremented and no trades are sent.  I have subscribed to Sierra Charts for a whole year last year and for that whole year, I was trading by automated trading via ASCIL codes.  That was my whole purpose of using Sierra Charts which is to do automatic trading. If my codes weren't working, WHY would I continue subscribe to Sierra Charts for a whole year?  I am NOT making claims that's not true.  This is what is happening to me.  All the codes that worked before, with nothing changed, I copied and pasted them into just a new .cpp file, compiled and all of sudden they are not working anymore. As to strings, this is what I want to do. I want to check for a substring in sc.Symbol which is a SCSTRING class variable but I can't find the function that checks for the substring of an SCSTRING, so I have ALWAYS assigned the sc.Symbol to a string class variable and use the "find" function in the string class to check to make sure that I am trading with the correct symbol. Below are my codes: if (sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED) { if (sc.Index == 0) { string Chart_Symbol; Chart_Symbol = sc.Symbol; if (Chart_Symbol.find("SVXY") != -1) { Symbol_OK = 1; } else { Symbol_OK = 0; } Trade_PosL = 0; Trade_PosS = 0; } //later on in my codes if (Symbol_OK == 1) { sc.BuyOrder(NewOrderObject); } } Very simple codes. Worked for a year now it's not working anymore. Any help is appreciated. Date Time Of Last Edit: 2017-06-08 06:48:49  | 
