Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple Plots every Tick on the Wick

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

    Multiple Plots every Tick on the Wick

    Hello,
    I would like to develop an indicator that draws me several lines the first at the close of the last closed candle, the next line a tick lower, the next again a tick lower until the low of the candle is reached. The lines should then be displayed as a plot on the DOM to simulate the candle shadow for quick orientation. I have created an indicator based on the Bollinerband, unfortunately does not work yet as desired. What I also do not like, I break the If loop when the condition Low[0]<Close-x*TickSize, could one solve this more elegantly?
    Thanks a lot​
    Attached Files

    #2
    ​protected override void OnBarUpdate()
    {
    int x=0;
    double delta = 0;
    int shift=0;


    delta = (Math.Abs(Close[0]-Low[0]));
    delta=delta;


    if (Close[0]<Open[0]) {

    Print(delta);
    while(shift==0)
    {

    MyPlot1[0] = Close[0];
    if (delta-TickSize <0) break;

    MyPlot2[0] = Close[0]-TickSize;

    if (delta-2*TickSize <=0) break;

    MyPlot3[0] = Close[0]-2*TickSize;

    if (delta-3*TickSize <=0) break;

    MyPlot4[0] = Close[0]-3*TickSize;

    if (delta-4*TickSize <=0) break;

    MyPlot5[0] = Close[0]-4*TickSize;

    if (delta-5*TickSize <=0) break;

    MyPlot6[0] = Close[0]-5*TickSize;

    if (delta-6*TickSize <=0) break;

    MyPlot7[0] = Close[0]-6*TickSize;

    if (delta-7*TickSize <=0) break;

    MyPlot8[0] = Close[0]-7*TickSize;

    if (delta-8*TickSize <=0) break;

    MyPlot9[0] = Close[0]-8*TickSize;

    if (delta-9*TickSize <=0) break;

    MyPlot10[0] = Close[0]-9*TickSize;

    if (delta-10*TickSize <=0) break;

    MyPlot11[0] = Close[0]-10*TickSize;

    if (delta-11*TickSize <=0) break;

    MyPlot12[0] = Close[0]-11*TickSize;

    if (delta-12*TickSize <=0) break;

    shift=1;
    break;
    }

    }
    else
    {

    while(shift==0)
    {

    MyPlot1[0] = Close[0];
    if (delta-TickSize <=0) break;

    MyPlot2[0] = Close[0]+TickSize;

    if (delta-2*TickSize <=0) break;

    MyPlot3[0] = Close[0]+2*TickSize;

    if (delta-3*TickSize <=0) break;

    MyPlot4[0] = Close[0]+3*TickSize;

    if (delta-4*TickSize <=0) break;

    MyPlot5[0] = Close[0]+4*TickSize;

    if (delta-5*TickSize <=0) break;

    MyPlot6[0] = Close[0]+5*TickSize;

    if (delta-6*TickSize <=0) break;

    MyPlot7[0] = Close[0]+6*TickSize;

    if (delta-7*TickSize <=0)break;

    MyPlot8[0] = Close[0]+7*TickSize;

    if (delta-8*TickSize <=0) break;

    MyPlot9[0] = Close[0]+8*TickSize;

    if (delta-9*TickSize <=0) break;

    MyPlot10[0] = Close[0]+9*TickSize;

    if (delta-10*TickSize <=0) break;

    MyPlot11[0] = Close[0]+11*TickSize;

    if (delta-11*TickSize <=0) break;

    MyPlot12[0] = Close[0]+12*TickSize;

    if (delta-12*TickSize <=0) break;

    shift=1;
    break;
    }​

    Comment


      #3
      Hello cedavra

      If you need help with loops I would suggest looking at external C# education websites that have information about C# loops.We do not suggest using while loops unless you make sure it has an exit so it does not lock the thread.

      To make various plots you would need to add the number of plots you wanted in OnStateChange and then reference them using the Values collection. For example Values[0] is the first plot, Values[1] is the second plot and so on. You use Values[index] = theValue; to set a plot.

      If you are going to use loops and multiple plots you need to loop through the count of plots you have and then set each plot to the value you wanted for each tick.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      51 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      31 views
      0 likes
      Last Post PaulMohn  
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      165 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      100 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      160 views
      2 likes
      Last Post CaptainJack  
      Working...
      X