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 sjsj2732, Today, 04:31 AM
      0 responses
      20 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      280 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      279 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      130 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      90 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X