Announcement

Collapse
No announcement yet.

OHLC Indictor in .net

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

  • OHLC Indictor in .net

    I am attempting to build a very simple Indicator
    (O+H+L+C)/4


    namespace PowerLanguage.Indicator {
    public class _plotAvgPrice : IndicatorObject {
    public _plotAvgPrice(object ctx) : base(ctx) {}
    private IPlotObject Plot1;
    protected override void Create() {
    Plot1 = AddPlot(new PlotAttributes("Close"));
    }
    protected override void CalcBar() {
    Plot1.Set(0, (Bars.OpenValue + Bars.HighValue + Bars.LowValue + Bars.CloseValue) / 4 );
    }
    }
    }


    Please advise
    Last edited by nextlevel0910; 10-22-2017, 05:53 AM.

  • #2
    What you are attempting to setup is a Pivot Indicator . Lets go thru what the PIVOT and what its calculations mean.

    In financial markets, a pivot point is a price level that is used by traders as a possible indicator of market movement. A pivot point is calculated as an average of significant prices (high, low, close) from the performance of a market in the prior trading period. If the market in the following period trades above the pivot point it is usually evaluated as a bullish sentiment, whereas trading below the pivot point is seen as bearish.

    It is customary to calculate additional levels of support and resistance, below and above the pivot point, respectively, by subtracting or adding price differentials calculated from previous trading ranges of the market.

    A pivot point and the associated support and resistance levels are often turning points for the direction of price movement in a market. In an up-trending market, the pivot point and the resistance levels may represent a ceiling level in price above which the uptrend is no longer sustainable and a reversal may occur. In a declining market, a pivot point and the support levels may represent a low price level of stability or a resistance to further decline.


    Calculation


    Several methods exist for calculating the pivot point (P) of a market. Most commonly, it is the arithmetic average of the high (H), low (L), and closing (C) prices of the market in the prior trading period: P = (H + L + C) / 3.
    Sometimes, the average also includes the previous period's or the current period's opening price (O): P = (O + H + L + C) / 4.
    In other cases, traders like to emphasize the closing price, P = (H + L + C + C) / 4, or the current periods opening price, P = (H + L + O + O) / 4.


    Last edited by Support; 10-23-2017, 06:45 AM.

    Comment


    • #3
      With the Multicharts.NET FREE Platform when you right click on the chart and click INSERT STUDY there is a FLOOR PIVOT indicator and OHLC indicator in there as well. Contact us if you need assistance loading to charts. please contact our 24 hour help desk in real-time via Phone or Live CHAT: https://www.ampfutures.com/contact-us/

      Comment


      • #4
        please let us know if the answers in this thread were able to help you get the indicator issue resolved. And thanks again for your participation.

        Comment


        • #5
          I have reviewed the two different you suggested, both are 80 / 20 pivot point indicators, which is not what I required.

          the indicator I need is simple

          (O+H+L+C)/4 and for this to plot on my chart that is all I need for my trading process.


          now, after further review, there is a function named: Avgprice:


          using System;

          namespace PowerLanguage.Function
          {
          public static class _AvgPrice
          {
          public static double AvgPrice( this IInstrument Bars, int _bb)
          {
          if (Bars.Open[_bb] > 0.0)
          {
          return (Bars.Open[_bb] + Bars.High[_bb] + Bars.Low[_bb] + Bars.Close[_bb]) / 4;
          }
          return (Bars.High[_bb] + Bars.Low[_bb] + Bars.Close[_bb]) / 3;
          }
          }



          This is what I need, but I need to include a plot for the chart with this statement but I don't know how to do this in C#

          so

          1. I need either an indicator which with call this function and included the plot for my chart

          OR

          2. I need to convert the detail of this function into an indicator and included a plot

          either way, this is the need indicator need for my trading process



          Please advise

          Comment


          • #6
            Originally posted by nextlevel0910 View Post
            I have reviewed the two different you suggested, both are 80 / 20 pivot point indicators, which is not what I required.

            the indicator I need is simple

            (O+H+L+C)/4 and for this to plot on my chart that is all I need for my trading process.


            now, after further review, there is a function named: Avgprice:


            using System;

            namespace PowerLanguage.Function
            {
            public static class _AvgPrice
            {
            public static double AvgPrice( this IInstrument Bars, int _bb)
            {
            if (Bars.Open[_bb] > 0.0)
            {
            return (Bars.Open[_bb] + Bars.High[_bb] + Bars.Low[_bb] + Bars.Close[_bb]) / 4;
            }
            return (Bars.High[_bb] + Bars.Low[_bb] + Bars.Close[_bb]) / 3;
            }
            }



            This is what I need, but I need to include a plot for the chart with this statement but I don't know how to do this in C#

            so

            1. I need either an indicator which with call this function and included the plot for my chart

            OR

            2. I need to convert the detail of this function into an indicator and included a plot

            either way, this is the need indicator need for my trading process



            Please advise
            I will copy your parameters in this post and forward to MC Support to get them to assist you in finding a solution. I will post once they have replied. thanks again for your participation in our forum.

            Comment


            • #7
              nextlevel0910,

              the code in your first post appears to do what you have in mind. Maybe you can post a screenshot of how it looks on your end and describe how it should look instead.
              Apart from that, you can test the below code, but the result is identical on my end:
              Code:
              using System;
              using System.Drawing;
              using System.Linq;
              using PowerLanguage.Function;
              
              namespace PowerLanguage.Indicator{
                    [SameAsSymbol(true)]    
                  public class _plotAvgPrice : IndicatorObject {
                      public _plotAvgPrice(object _ctx):base(_ctx){}
                      private IPlotObject plot1;
                      protected override void Create() {
                          // create variable objects, function objects, plot objects etc.
                          plot1 = AddPlot(new PlotAttributes("AvgPrice", EPlotShapes.Line, Color.Red));
                      }
                      protected override void StartCalc() {
                          // assign inputs
                      }
                      protected override void CalcBar(){
                          // indicator logic
                          double avgPrice = ( Bars.Open[0] + Bars.High[0] + Bars.Low[0] + Bars.Close[0]) * .25;
              
                          plot1.Set(avgPrice);
                      }
                  }
              }
              Regards,

              ABCTradingGroup


              Originally posted by nextlevel0910 View Post
              I am attempting to build a very simple Indicator
              (O+H+L+C)/4


              namespace PowerLanguage.Indicator {
              public class _plotAvgPrice : IndicatorObject {
              public _plotAvgPrice(object ctx) : base(ctx) {}
              private IPlotObject Plot1;
              protected override void Create() {
              Plot1 = AddPlot(new PlotAttributes("Close"));
              }
              protected override void CalcBar() {
              Plot1.Set(0, (Bars.OpenValue + Bars.HighValue + Bars.LowValue + Bars.CloseValue) / 4 );
              }
              }
              }


              Please advise

              Comment

              Disclaimer: There is a risk of loss in trading futures, forex and options. Futures, forex and options trading are not appropriate for all investors. Only risk capital should be used when trading futures. All information is for educational use only and is not investment advice. Past performance is not indicative of future results.

              This website is hosted and operated by AMP Global Clearing, LLC ("AMP"), which provides brokerage services to traders of futures and foreign exchange products. This website is intended for customer support, educational and informational purposes only and should NOT be viewed as a solicitation or recommendation of any product, service or trading strategy. No offer or solicitation to buy or sell derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given, or in any manner endorsed by AMP and the information made available on this Web site is NOT an offer or solicitation of any kind. The content and opinions expressed on this website are those of the authors and do not necessarily reflect the official policy or position of AMP.

              All Users and Contributors along with their websites, products and services, are independent persons or companies that are in no manner affiliated with AMP. AMP is not responsible for, do not approve, recommend or endorse any User and/or Contributor Content referenced on this website and it’s your sole responsibility to evaluate All Content. Please be aware that any performance information provided by a user and/or contributor should be considered hypothetical.

              HYPOTHETICAL PERFORMANCE RESULTS HAVE MANY INHERENT LIMITATIONS, SOME OF WHICH ARE DESCRIBED BELOW. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFITS OR LOSSES SIMILAR TO THOSE SHOWN. IN FACT, THERE ARE FREQUENTLY SHARP DIFFERENCES BETWEEN HYPOTHETICAL PERFORMANCE RESULTS AND THE ACTUAL RESULTS SUBSEQUENTLY ACHIEVED BY ANY PARTICULAR TRADING PROGRAM.

              ONE OF THE LIMITATIONS OF HYPOTHETICAL PERFORMANCE RESULTS IS THAT THEY ARE GENERALLY PREPARED WITH THE BENEFIT OF HINDSIGHT. IN ADDITION, HYPOTHETICAL TRADING DOES NOT INVOLVE FINANCIAL RISK, AND NO HYPOTHETICAL TRADING RECORD CAN COMPLETELY ACCOUNT FOR THE IMPACT OF FINANCIAL RISK IN ACTUAL TRADING. FOR EXAMPLE, THE ABILITY TO WITHSTAND LOSSES OR TO ADHERE TO A PARTICULAR TRADING PROGRAM IN SPITE OF TRADING LOSSES ARE MATERIAL POINTS WHICH CAN ALSO ADVERSELY AFFECT ACTUAL TRADING RESULTS. THERE ARE NUMEROUS OTHER FACTORS RELATED TO THE MARKETS IN GENERAL OR TO THE IMPLEMENTATION OF ANY SPECIFIC TRADING PROGRAM WHICH CANNOT BE FULLY ACCOUNTED FOR IN THE PREPARATION OF HYPOTHETICAL PERFORMANCE RESULTS AND ALL OF WHICH CAN ADVERSELY AFFECT ACTUAL TRADING RESULTS.

              AMP has NOT endorsed or recommended the use any product, services offered by any 3rd party User or Contributor on this forum. No person employed by, or associated with, AMP is authorized to provide any information about any 3rd party User or Contributor content. All specific brokerage related questions should be directed towards AMP.

              Copyright © 2017. All rights reserved.

              Working...
              X