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:	149
Size:	580.4 KB
ID:	1269169

    Click image for larger version

Name:	image.png
Views:	417
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:	137
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:	130
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 NullPointStrategies, Today, 05:17 AM
            0 responses
            51 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            127 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            69 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            42 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            46 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X