Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using IchimokuIndicator for Strategy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Using IchimokuIndicator for Strategy

    I want to include Ichimoku indicator in my algo, since it would eliminate a bunch of otherwise 50/50 trades. I'm using the "IchimokuSignal" shared here.

    I found this bit of code, and seems useful and straight forward. arrows are drawn based on wether iSeekSignal leads them to be bullish or bearish.

    // ArrowBrush color is for testing only, but it is also used to determine iSignalStrength
    bArrowDn = (iSeekSignal % 2 != 0); // down signal = odd number
    if(iSeekSignal==icSignal_KB_DN || iSeekSignal==icSignal_KB_UP)
    ArrowBrush = (iSeekSignal==icSignal_KB_DN) ? Brushes.Red : Brushes.Green;
    else
    switch(iCloudStatus)
    {
    case icBelowCloud:
    ArrowBrush = bArrowDn ? Brushes.Red : Brushes.DarkGray;
    break;
    case icInCloud:
    ArrowBrush = Brushes.LightGray;
    break;
    case icAboveCloud:
    ArrowBrush = bArrowDn ? Brushes.DarkGray : Brushes.Green;
    break;
    default:
    break;
    }

    So I want to test for that in my own strategy as well. I've copied over all of the initializing parameters to my strategy, so that I can call the indicator class with the proper required variables.

    My thought thus is to test IF:

    (IchimokuSignal(Conversion, BBase, SpanB, Lag, Isignal_Strong, Isignal_Neutral, Isignal_Weak, Ilegend).iSeekSignal==icSignal_KB_DN --> test for others things and buy.

    However, I get an exception that "iSeekSignal" is not identified anywhere in IchimokuSignal; and that's true, but I thought that was odd, that the indicator worked in first place, and then I couldn't find where it EVER got its value from the class... Here's the variables defined in "IchimokuSignal", can't share the entire code.
    What should I call to test if it's bullish/bearish, as in buy or sell entry, anyone see what I'm missing? Greatly appreciated, still a novice in C#

    #region Using declarations
    #endregion

    //This namespace holds Indicators in this folder and is required. Do not change it.
    namespace NinjaTrader.NinjaScript.Indicators
    {
    public class IchimokuSignal : Indicator
    {
    // for Ichimoku Signals by kkc2015, see document from IchimokuTrader.com
    private const int icTrendSpan = 4; // 4 previous trading days, used for avoiding whipsaw signals
    private const int icNoSignal = 0;
    private const int icBelowCloud = 1; // signal occurred below the cloud
    private const int icInCloud = 2;
    private const int icAboveCloud = 3;
    private const int icSignal_Base = 11; // use for adjusting icSignal_ to start from 0
    private const int icSignal_TK = icSignal_Base+0; // TK = signal for Tenkan / Kijun sen crossed up
    private const int icSignal_PK = icSignal_Base+1; // do not change number sequence from _TK to _CP
    private const int icSignal_KB = icSignal_Base+2;
    private const int icSignal_SS = icSignal_Base+3;
    private const int icSignal_CP = icSignal_Base+4; // do not change number sequence from _TK to _CP
    private const int icSignal_LS = icSignal_Base+5; // trade record [Long/Short]
    private const int icSignal_DU = icSignal_Base+6; // Alert [Down / Up trend]
    private const int icSignalType = 5; // exclude icSignal_LS
    private const int icReadTradeData = -2; // flag to show that ReadTradeData is completed, do not repeat
    private const int icMACD_data = -3; // flag to show that MACD data is completed, do not repeat
    private const int icMACD_Peak = 1; // check for MACD peaks
    private const int icMACD_Valley = 2; // check for MACD valleys
    private const bool bMACD_Completed = true; // used by MACD function

    private static readonly int[] icSignals = {icSignal_TK,icSignal_PK,icSignal_KB,icSignal_SS,i cSignal_CP};
    private static readonly string[] scSignals = {"TK", "PK", "KB", "SS", "CP", "LS", "DU"};

    private const int icSignal_start = 100; // use for adjusting TK_DN to start from 1
    private const int icSignal_TK_DN = 101; // _DN = odd number = signal for Tenkan / Kijun sen crossed down
    private const int icSignal_TK_UP = 102; // _UP = even number = signal for Tenkan / Kijun sen crossed up
    private const int icSignal_PK_DN = 103;
    private const int icSignal_PK_UP = 104;
    private const int icSignal_KB_DN = 105;
    private const int icSignal_KB_UP = 106;
    private const int icSignal_SS_DN = 107;
    private const int icSignal_SS_UP = 108;
    private const int icSignal_CP_DN = 109;
    private const int icSignal_CP_UP = 110;

    private const int icSignal_Weak = 1;
    private const int icSignal_Neutral = 2;
    private const int icSignal_Strong = 3;
    private const int icSignal_Trade = 4;
    // 5 Ichimoku signal types
    private int iSignal = icNoSignal;
    public string sSignalCode = " ";
    private bool bArrowDn = false;
    private int iSignalStrength = icSignal_Neutral;
    private double dChart_Ymin = 90.0; // Y value (=Price) at the bottom of chart
    private double dChart_Ymax = 134.0; // Y value (=Price) at the top of chart
    private double dChart_Y = 0.0; // Y location for showing the arrow
    private double dChart_Yspan = 100.0;
    private static int iNbrSameBar = 0;
    private string sLegend = "SignalColor: LightGray(weak), NoColor(Neutral), Green/Red(strong)\n" +
    "Cross:\tTK - Tenkan / Kijun, PK - Price / Kijun, KB - Price / Kumo,\n\tSS - Senkou SpanA / SpanB, CP - Chikou / Price\n";

    NinjaTrader.Gui.Tools.SimpleFont LegendFont = new NinjaTrader.Gui.Tools.SimpleFont("Courier New", 12);
    private Brush ArrowBrush = Brushes.DarkGray; // use for debugging, do not remove

    // for SharpDX drawing of Ichimoku cloud and Indicator ColorBar
    private Brush upAreaBrush = Brushes.LightGreen;
    private Brush dnAreaBrush = Brushes.Pink;
    private Brush upLineBrush = Brushes.DarkGreen;
    private Brush dnLineBrush = Brushes.Red;
    private Brush textBrush = Brushes.Black;
    int iareaOpacity = 55; // this provides reasonable cloud density, can be changed by user input
    const float fontHeight = 12f;
    int iX_barWidth = 10; // space for each bar, initialize at OnRender()

    private SharpDX.Direct2D1.Brush upAreaBrushDx, dnAreaBrushDx, upLineBrushDx, dnLineBrushDx, textBrushDx;

    private static int iSignalIdx = 0;
    private bool bRendering = false;
    private static bool bGetSignal = false;
    private const int icSignalMax = 2000;
    private const int icSignalSort = -999; // to indicate that stSignal_all[] requires sorting
    public struct stSignal
    {
    public int iBar;
    public int iSignal;
    public bool bTrendDown;
    public int iStrength;
    public int iNbrSignal;
    };
    // [0].iBar = total number of signals. [0].iNbrSignal = icReadTradeData, [0].iStrength = icMACD_data
    private stSignal[] stSignal_all = new stSignal[icSignalMax+1];

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Display Ichimoku cloud / indicators.";
    Name = "IchimokuSignal_B0";
    Calculate = Calculate.OnBarClose;
    IsOverlay = true;
    DisplayInDataBox = true;
    DrawOnPricePanel = true;
    DrawHorizontalGridLines = true;
    DrawVerticalGridLines = true;
    PaintPriceMarkers = true;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    //Disable this property if your indicator requires custom values that cumulate with each new market data event.
    //See Help Guide for additional information.
    IsSuspendedWhileInactive = true;
    Conversion = 9;
    BBase = 26;
    SpanB = 52;
    Lag = 26;
    Isignal_Strong = true;
    Isignal_Neutral = false;
    Isignal_Weak = false;
    Ilegend = true;

    upAreaBrush = Brushes.LightGreen;
    dnAreaBrush = Brushes.Pink;
    upLineBrush = Brushes.DarkGreen;
    dnLineBrush = Brushes.Red;
    iareaOpacity = 55;

    AddPlot(Brushes.Purple, "ConversionLine"); // Plots[0]
    AddPlot(Brushes.Teal, "BaseLine"); // Plots[1]
    AddPlot(Brushes.Transparent, "SpanALine"); // Plots[2]
    AddPlot(Brushes.Transparent, "SpanBLine"); // Plots[3]
    AddPlot(Brushes.Transparent, "LagLine"); // Plots[5]
    }
    else if (State == State.Configure)
    {
    //AddDataSeries(Instrument.FullName, Data.BarsPeriodType.Day, 1, Data.MarketDataType.Last);
    ZOrder = -1; // 2016.05.24, per ReusableBrushExample
    }
    else if (State == State.Historical)
    {
    // 2016.05.24 from Ninjascript ReuseDxBrushesExample.cs
    if (upAreaBrush.IsFrozen)
    upAreaBrush = upAreaBrush.Clone(); // this will ensure that previous drawing using this brush is not affected
    upAreaBrush.Opacity = iareaOpacity / 100d; // .Opacity[0..1]
    upAreaBrush.Freeze(); // freeze brush so that it can be changed later by other functions
    upAreaBrushDx = upAreaBrush.ToDxBrush(RenderTarget);

    if (dnAreaBrush.IsFrozen)
    dnAreaBrush = dnAreaBrush.Clone();
    dnAreaBrush.Opacity = iareaOpacity / 100d;
    dnAreaBrush.Freeze();
    dnAreaBrushDx = dnAreaBrush.ToDxBrush(RenderTarget);

    // the following brushes are not to be changed
    upLineBrushDx = upLineBrush.ToDxBrush(RenderTarget);
    dnLineBrushDx = dnLineBrush.ToDxBrush(RenderTarget);
    textBrushDx = textBrush.ToDxBrush(RenderTarget);
    }
    }

    #2
    Hello lmatiukas,

    Somewhere iSeekSignal is defined.

    In the original script, if any variable is not defined this will cause an error.

    I would recommend taking a second look at the original script to see where these are defined.
    Is it possible there is an accompanying file that contains the class iSeekSignal?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      thanks for such a quick reply.

      Should I move this over to strategy development? (As in delete, and paste) Didn't notice what channel I was on. Also, would still like to keep this questions posted on a bigger scale - what should be tested in first place? I imagine this would be a good addition to anyone's auto trading strategy

      Comment


        #4
        Hello lmatiukas,

        iSeekSignal appears to be a custom class or another indicator.

        An object is being created with iSeekSignal as the type. Look for private iSeekSignal <some variable name> or public iSeekSignal <some variable name>.

        I'm not quite certain what you are trying to do. The Ichimoku indicator version you are using is needing a parameter when called with the type iSeekSignal?

        If so, there is a property with the type iSeekSignal.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          This is both methods where "iSeekSignal" is placed in. It doesn't appear anywhere else. However, what I'm trying to do is test in my strategy if ichimoku is bullish/bearish, etc. I'm looking over "IchimokuSignal" indicator code, and I'm trying to debut printouts of various variables, but they all return the same number, no matter when.

          Just not seeing what I should be returning. Additionally, almost every method is void, so I feel like there's not much to look at either. The two methods below, are also the only ones with a return.

          public int ArrowCodes(int iSeekSignal)
          {
          int iCloudStatus = icInCloud;
          // ConversionLine[barsAgo] = Tenkan Sen
          // BaseLine[barsAgo] = Kijun Sen
          // SpanALine[barsAgo] = Senkou Span A
          // SpanBLine[barsAgo] = Senkou Span B
          ArrowBrush = Brushes.LightGray;
          sSignalCode = " "; // no signal code

          switch(iSeekSignal)
          {
          case icSignal_TK_DN: // Tenkan / Kijun Cross in relation to cloud
          case icSignal_TK_UP:
          sSignalCode = "TK";
          iCloudStatus = iGetCloudStatus(ConversionLine[0]); // use data[0 BarAgo], *** neeed checking ***
          break;
          case icSignal_PK_DN:
          case icSignal_PK_UP:
          sSignalCode = "PK";
          iCloudStatus = iGetCloudStatus(Close[0]); // use data[0 BarAgo]
          break;
          case icSignal_KB_DN: // the price is always inside Kumo cloud, waiting for breakout
          case icSignal_KB_UP:
          sSignalCode = "KB";
          break;
          case icSignal_SS_DN:
          case icSignal_SS_UP:
          sSignalCode = "SS";
          iCloudStatus = iGetCloudStatus(SpanALine[0]); // use data[0 BarAgo]
          break;
          case icSignal_CP_DN:
          case icSignal_CP_UP:
          sSignalCode = "CP";
          // cloud and Chikoou Span data should be at Lag bar ago
          iCloudStatus = iGetCloudStatus(Close[Lag],Lag);
          break;
          default:
          break;
          }
          // ArrowBrush color is for testing only, but it is also used to determine iSignalStrength
          bArrowDn = (iSeekSignal % 2 != 0); // down signal = odd number
          if(iSeekSignal==icSignal_KB_DN || iSeekSignal==icSignal_KB_UP)
          ArrowBrush = (iSeekSignal==icSignal_KB_DN) ? Brushes.Red : Brushes.Green;
          else
          switch(iCloudStatus)
          {
          case icBelowCloud:
          ArrowBrush = bArrowDn ? Brushes.Red : Brushes.DarkGray;
          break;
          case icInCloud:
          ArrowBrush = Brushes.LightGray;
          break;
          case icAboveCloud:
          ArrowBrush = bArrowDn ? Brushes.DarkGray : Brushes.Green;
          break;
          default:
          break;
          }
          // set signal strength
          iSignalStrength = icSignal_Strong;
          if(ArrowBrush == Brushes.DarkGray)
          iSignalStrength = icSignal_Weak;
          else if(ArrowBrush == Brushes.LightGray)
          iSignalStrength = icSignal_Neutral;
          return(iSignalStrength);
          }

          protected int iGetCloudStatus(double dY, int iLag=0)
          {
          // dY has data from 1 BarAgo
          int iRetSignal = icInCloud;

          if(dY < Math.Min(SpanALine[0+BBase+iLag],SpanBLine[0+BBase+iLag]))
          iRetSignal = icBelowCloud;
          else
          if(dY > Math.Max(SpanALine[0+BBase+iLag],SpanBLine[0+BBase+iLag]))
          iRetSignal = icAboveCloud;
          return(iRetSignal);
          }

          // 2015.12.31, return CrossSignal, _DN, _UP
          public int iGetCrossSignal(int iSeekSignal)
          {
          int i, iUpDown;
          int iRetSignal = icNoSignal;
          bool bConditionMet = false;
          if(CurrentBar < SpanB+icTrendSpan || CurrentBar < Conversion+icTrendSpan || CurrentBar < Lag+icTrendSpan || CurrentBar < BBase+icTrendSpan)
          return(iRetSignal);

          switch(iSeekSignal)
          {
          case icSignal_TK: // check signal for Tenkan / Kijun Crossed
          bConditionMet = true;
          // check for Tankan above Kijun BaseLine
          for(i=1; i<=icTrendSpan; i++)
          if(ConversionLine[i] <= BaseLine[i])
          bConditionMet = false;
          if(bConditionMet) // Tankan is above Kijan sen, precursory for downtrend
          iRetSignal = (ConversionLine[0] <= BaseLine[0]) ? icSignal_TK_DN : icNoSignal;
          else
          {
          bConditionMet = true;
          // check for Tankan below Kijun BaseLine
          for(i=1; i<=icTrendSpan; i++)
          if(ConversionLine[i] >= BaseLine[i])
          bConditionMet = false;
          if(bConditionMet) // Tankan is below Kijan sen, precursory for uptrend
          iRetSignal = (ConversionLine[0] >= BaseLine[0]) ? icSignal_TK_UP : icNoSignal;
          }
          break;
          case icSignal_PK: // check signal for price crosses Kijun sen
          bConditionMet = true;
          // check for Price above Kijun BaseLine
          for(i=1; i<=icTrendSpan; i++)
          if(Low[i] <= BaseLine[i])
          bConditionMet = false;
          if(bConditionMet) // Close Price is above Kijan sen, precursory for downtrend
          iRetSignal = (Close[0] <= BaseLine[0]) ? icSignal_PK_DN : icNoSignal;
          else
          {
          bConditionMet = true;
          // check for Price below Kijun BaseLine
          for(i=1; i<=icTrendSpan; i++)
          if(High[i] >= BaseLine[i])
          bConditionMet = false;
          if(bConditionMet) // Price is below Kijun sen, precursory for uptrend
          iRetSignal = (Close[0] >= BaseLine[0]) ? icSignal_PK_UP : icNoSignal;
          }
          break;
          case icSignal_KB: // check for Kumo Breakout, Kumo data is from older data[BBase]
          bConditionMet = true;
          // check for Price below top of Kumo cloud
          for(i=1; i<=icTrendSpan; i++)
          if(Close[i] >= Math.Max(SpanALine[i+BBase],SpanBLine[i+BBase]))
          bConditionMet = false;
          if(bConditionMet) // Close Price is below top of cloud, precursory for uptrend breakout
          iRetSignal = (Close[0] >= Math.Max(SpanALine[0+BBase],SpanBLine[0+BBase])) ? icSignal_KB_UP : icNoSignal;
          if(iRetSignal == icNoSignal)
          {
          bConditionMet = true;
          // check for Price above bottom of Kumo cloud
          for(i=1; i<=icTrendSpan; i++)
          if(Close[i] <= Math.Min(SpanALine[i+BBase],SpanBLine[i+BBase]))
          bConditionMet = false;
          if(bConditionMet) // Price is above bottom of cloud, precursory for downtrend
          iRetSignal = (Close[0] <= Math.Min(SpanALine[0+BBase],SpanBLine[0+BBase])) ? icSignal_KB_DN : icNoSignal;
          }
          break;
          case icSignal_SS: // check signal for Senkou SpanA / SpanB cross
          bConditionMet = true;
          // check for SpanA above SpanB
          for(i=1; i<=icTrendSpan; i++)
          if(SpanALine[i] <= SpanBLine[i])
          bConditionMet = false;
          if(bConditionMet) // SpanALine is above SpanBLine, precursory for downtrend
          iRetSignal = (SpanALine[0] <= SpanBLine[0]) ? icSignal_SS_DN : icNoSignal;
          else
          {
          bConditionMet = true;
          // check for SpanA below SpanB
          for(i=1; i<=icTrendSpan; i++)
          if(SpanALine[i] >= SpanBLine[i])
          bConditionMet = false;
          if(bConditionMet) // SpanALine is below SpanBLine, precursory for uptrend
          iRetSignal = (SpanALine[0] >= SpanBLine[0]) ? icSignal_SS_UP : icNoSignal;
          }
          break;
          case icSignal_CP: // check signal for Chikou Span Cross, all data to be based on [Lag]
          bConditionMet = true;
          // check for Chikou Span above Price, LagLine[Lag] = Close[0]
          for(i=1; i<=icTrendSpan; i++)
          if(LagLine[Lag+i] <= High[Lag+i])
          bConditionMet = false;
          if(bConditionMet) // Chikou Span is above Price, precursory for downtrend
          iRetSignal = (LagLine[Lag] <= Close[Lag]) ? icSignal_CP_DN : icNoSignal;
          else
          {
          bConditionMet = true;
          // check for Chikou Span below Price
          for(i=1; i<=icTrendSpan; i++)
          if(LagLine[Lag+i] >= Low[Lag+i])
          bConditionMet = false;
          if(bConditionMet) // Price is below Kijun sen, precursory for uptrend
          iRetSignal = (LagLine[Lag] >= Close[Lag]) ? icSignal_CP_UP : icNoSignal;
          }
          break;
          default:
          break;
          }
          return(iRetSignal);

          Comment


            #6
            What shall I reference in Strategy

            maybe a simpler question....

            This is the "onBarUpdate()" method, and I have to think I want to always reference something from here over to my strategy, at least that's been the case with easier indicators. So that would be IchimokuSignal(all paremeters).XXX

            But since nothing is really defined as the "signal" parameter, just wondering if someone who knows a) this code or b) this indicator better, could tell me what I should check for.

            like is it.. crossAbove((SpanALine[0],SpanBLine[0]),3).

            Since the chart gives very clear indicators for opportune signals, I wish I could just use those, but I don't see of a way to link that in, so I'm thinking this above scenario is the way to do it, just seems tedious as it would be re-writing a bunch of an indicator code into the strategy, rather than just calling for a signal indicator.

            protected override void OnBarUpdate()
            {
            //Add your custom indicator logic here.
            if(CurrentBar < SpanB)
            {
            iSignalIdx = 0;
            stSignal_all[0].iBar = iSignalIdx; // initialize maximum number of bars
            stSignal_all[0].iSignal = icSignalSort; // initialize signal to sort the struct
            stSignal_all[0].iNbrSignal = -1; // initialize to indicate fresh set of data
            stSignal_all[0].iStrength = -1;
            }
            if(CurrentBar < SpanB || CurrentBar < Conversion || CurrentBar < Lag || CurrentBar < BBase){return;}

            // Tenkan sen = ConversionLine, Kijun sen = BaseLine, Senkou Span A = SpanALine, Senkou Span B = SpanBLine
            ConversionLine[0] = ((MAX(High,Conversion)[0] + MIN(Low,Conversion)[0]) / 2);
            BaseLine[0] = ((MAX(High,BBase)[0] + MIN(Low,BBase)[0]) / 2);
            SpanALine[0] = ((ConversionLine[0] + BaseLine[0]) / 2);
            SpanBLine[0] = ((MAX(High,SpanB)[0] + MIN(Low,SpanB)[0]) / 2);
            LagLine[Lag] = Close[0];

            // kkc_2015 2015.12.31 display Ichimoku signals as per IchimokuTrader.com
            dChart_Y = Low[0] - 20*TickSize;
            if((Isignal_Strong || Isignal_Neutral || Isignal_Weak) && (iSignalIdx < icSignalMax-1))
            {
            for(int i=0; i<icSignalType; i++)
            {
            // signal type is identified sequentially from icSignal_TK to _CP
            if((iSignal = iGetCrossSignal(icSignals[i])) > icNoSignal)
            {
            iSignalStrength = ArrowCodes(iSignal); // ArrowBrush & sSignalCode are updated icSignals
            ++iSignalIdx;
            iSignalIdx = Math.Min(iSignalIdx,icSignalMax); // make sure not to exceed nbr of signals
            stSignal_all[iSignalIdx].iBar = (icSignals[i]==icSignal_CP) ? CurrentBar-Lag :CurrentBar;
            stSignal_all[iSignalIdx].iSignal = icSignals[i];
            stSignal_all[iSignalIdx].iStrength = iSignalStrength;
            stSignal_all[0].iBar = iSignalIdx; // total number of signals within the data
            bArrowDn = (iSignal % 2 != 0); // down signal = odd number
            stSignal_all[iSignalIdx].bTrendDown = bArrowDn;
            stSignal_all[iSignalIdx].iNbrSignal = 0; // number of signals for each bar, 0 = 1 signal

            }
            }
            }
            }

            Comment


              #7
              thanks for chiming in

              no worries. Looked up the definitions better, and added Ichimoku signals to my algo, up to 68% positive results, coding along.

              thank you, consider this question closed

              Comment


                #8
                Hello lmatiukas,

                iSeekSignal is declared as a parameter of the ArrowCodes method and iGetCrossSignal method and is an integer.

                public int ArrowCodes(int iSeekSignal)

                As ArrowCodes is called, an integer is passed in. For example if I called ArrowCodes(5);. iSeekSignal becomes the variable that holds the 5 in the ArrowCodes method when it is called.

                Because this is declared as a parameter of the method call, this variable can only be used within the action block of those two methods.

                May I confirm you are not trying to call iSeekSignal somewhere outside of the ArrowCodes
                method and iGetCrossSignal method?


                iSeekSignal is not a property of the IchimokuSignal indicator and cannot be set for the entire indicator. It a local variable that only be used in these methods.
                Last edited by NinjaTrader_ChelseaB; 05-31-2017, 07:35 AM.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  The best way to expose the signals are as follows:

                  1. find the existing line below:
                  private stSignal[] stSignal_all = new stSignal[icSignalMax+1]; // existing code
                  2. add the following two lines
                  [XmlIgnore]
                  public Series<int> iSignal_Ext; // name of external integer data series

                  3. Inside OnBarUpdate(), add:
                  iSignal_Ext[0] = icNoSignal; // initialize

                  4. Inside OnBarUpdate(), find the existing line below, which is inside the if{iSignal...}
                  stSignal_all[iSignalIdx].iNbrSignal = 0; // number of signals for each bar, 0 = 1 signal

                  5. add the following line
                  iSignal_Ext[0] = icSignals[i]; // [0] = 0 barsAgo

                  6. Check for signal as follows:
                  if(iSignal_Ext[0] == icSignal_TK_DN) ... // the signal types are listed.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by prdecast, Today, 06:07 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post prdecast  
                  Started by i019945nj, 12-14-2023, 06:41 AM
                  3 responses
                  60 views
                  0 likes
                  Last Post i019945nj  
                  Started by TraderBCL, Today, 04:38 AM
                  2 responses
                  18 views
                  0 likes
                  Last Post TraderBCL  
                  Started by martin70, 03-24-2023, 04:58 AM
                  14 responses
                  106 views
                  0 likes
                  Last Post martin70  
                  Started by Radano, 06-10-2021, 01:40 AM
                  19 responses
                  610 views
                  0 likes
                  Last Post Radano
                  by Radano
                   
                  Working...
                  X