Support Board
Date/Time: Mon, 24 Feb 2025 01:06:00 +0000
Post From: turning a subgraph into a system error
[2021-02-22 07:17:35] |
Flipper_2 - Posts: 57 |
//Trading system based on the above calculations
//signal long if (sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED && Subgraph_Close > 300 && Subgraph_Low < -300) { //send order int Result = (int)sc.BuyEntry(NewOrder); // send the mkt order if (Result > 0) //If there has been a successful order entry, then draw an arrow at the low of the bar. { Subgraph_Buy[sc.Index] = sc.Low[sc.Index] - OffsetPercent * Range; Subgraph_Sell[sc.Index] = 0; } } //signal short else if (sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED && Subgraph_Close < 300 && Subgraph_High > 300) { //send order int Result = (int)sc.SellEntry(NewOrder); //send the mkt order if (Result > 0) //If there has been a successful order entry, then draw an arrow at the high of the bar. { Subgraph_Sell[sc.Index] = sc.High[sc.Index] + OffsetPercent * Range; Subgraph_Buy[sc.Index] = 0; } } else //if no signal condition met, do nothing { Subgraph_Buy[sc.Index] = 0; Subgraph_Sell[sc.Index] = 0; } This whole code block will not work. You have the study set on manual looping so sc.Index will not work. And then the whole block is outside the loop anyway. And Subgraph_Close < 300 will not work because you haven't provided an index for the Array, it should be something like Subgraph_Close[sc.Index] or Subgraph_Close[sc.Index - 1] for auto looping (which you haven't set) or Subgraph_Close[Index] if its in the main loop.You would be far better off making a new study just for the trading system and importing the arrays from other studies that you want to base your signals on using this, sc.GetStudyArrayUsingID() ACSIL Interface Members - Functions: sc.GetStudyArrayUsingID() |