Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with plotting values to DataBox for strategy use

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

    Help with plotting values to DataBox for strategy use

    I am looking for to plot all availble support reistance levels (upper and lower price), so it can be used in strategy. I want to start with plotting the type R for resistance and s for Support. it compains that it cant convert. Issue is probably with referencing list type correctly.

    Currently indicator is not plotting anything to the databox
    I was hoping some one can help



    AddPlot(Brushes.Blue, "MyPlot1"); // <-- this becomes Values[0]
    AddPlot(Brushes.Green, "MyPlot2"); // <-- this becomes Values[1]​

    MyPlot1[0] = FVGType.R;
    MyPlot2[0] = FVGType.S;​

    [Browsable(false)]
    [XmlIgnore]
    public Series<FVGType> MyPlot1
    { get { return Values[0]; } }

    [Browsable(false)]
    [XmlIgnore]
    public Series<FVGType> MyPlot2
    { get { return Values[1]; } }​

    Code:
     public class FVGIndTest : Indicator
        {
            // Support or Resistance FVG
            public enum FVGType
            {
                S, R
            }
    
            #region Class FVG
    //        public List<FVGTYPESR> ;
            public class FVG
    
            {
                public double upperPrice;
                public double lowerPrice;
                public double consequentEncroachmentPrice;
                public string tag;
                public FVGType type;
                public bool filled;
                public DateTime gapStartTime;
                public DateTime fillTime;
    
                public FVG(string tag, FVGType type, double lowerPrice, double uppperPrice, DateTime gapStartTime)
                {
                    this.tag = tag;
                    this.type = type;
                    this.lowerPrice = lowerPrice;
                    this.upperPrice = uppperPrice;
                    this.consequentEncroachmentPrice = (this.lowerPrice + this.upperPrice) / 2.0;
                    this.filled = false;
                    this.gapStartTime = gapStartTime;
                }
            }
            #endregion
    ​
    Click image for larger version

Name:	image.png
Views:	160
Size:	580.4 KB
ID:	1269169

    Click image for larger version

Name:	image.png
Views:	426
Size:	7.3 KB
ID:	1269168

    #2
    Hello tkaboris,

    Plots are type Series<double> you need to change the public properties you made to use Series<double> instead.

    Comment


      #3
      I changed that but still have error.
      FVGType.R is not a double it returns enum R or S
      Click image for larger version

Name:	image.png
Views:	147
Size:	346.5 KB
ID:	1269178

      Comment


        #4
        Hello tkaboris,

        If those are plots you need to use a bars ago with them to get a value. [0]

        Comment


          #5
          it says it cant apply indexing
          Click image for larger version

Name:	image.png
Views:	139
Size:	372.3 KB
ID:	1269181

          Comment


            #6
            Hello tkaboris,

            Unfortunately I am not sure what you are trying to accomplish with the code you had provided in post 1. You would need to have some kind of price value if you want to set a plot. Looking at that code you provided the R and S are enums, you would have to use code that returns a price instead.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            89 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            135 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            68 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            119 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            69 views
            0 likes
            Last Post PaulMohn  
            Working...
            X