forex software

Create and Test Forex Strategies

forex software

Skip to forum content

Forex Forum

Forex Software, Forex Strategies, Expert Advisors Generator

You are not logged in. Please login or register.


Forex Forum → Technical Indicators → forcing base price change the indicator calculations

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 6

Topic: forcing base price change the indicator calculations

Hello Pop
When trying to force MA indicator to use only close it gives me different calculations from the normal use of baseprice (close) !!!!!!

The original code :

IndParam.ListParam[2].Caption = "Base price";
            IndParam.ListParam[2].ItemList = Enum.GetNames(typeof (BasePrice));
            IndParam.ListParam[2].Index = (int) BasePrice.Close;
            IndParam.ListParam[2].Text = IndParam.ListParam[2].ItemList[IndParam.ListParam[2].Index];
            IndParam.ListParam[2].Enabled = true;
            IndParam.ListParam[2].ToolTip = "The price Moving Average is based on.";

The modified code :

 IndParam.ListParam[2].Caption = "Base price";
            IndParam.ListParam[2].ItemList = new[] { "Close" };
            IndParam.ListParam[2].Index = 0;
            IndParam.ListParam[2].Text = IndParam.ListParam[2].ItemList[IndParam.ListParam[2].Index];
            IndParam.ListParam[2].Enabled = true;
            IndParam.ListParam[2].ToolTip = "The price the central Moving Average is based on.";

logically they should plot identical lines but it didnot happen !!!!

Post's attachments

MAs.png
MAs.png 8.11 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: forcing base price change the indicator calculations

I think you need to keep index as in the original. And forcing comes easier when you do it in the calc block, why waste time with a parameter window? But the latter is only my opinion.

Re: forcing base price change the indicator calculations

Your code is correct.

I may help you with the code if you attach both indicators.

I can only suppose that you haven;t changed the "Calculate" method correspondingly.

The original code is:

        public override void Calculate(IDataSet dataSet)
        {
            DataSet = dataSet;

            // Reading the parameters
            BasePrice basePrice = (BasePrice)IndParam.ListParam[2].Index;

It will not work with your modification because it will covert the index 0 to BasePrice.Open.

You have to change the code to that:

        public override void Calculate(IDataSet dataSet)
        {
            DataSet = dataSet;

            // Reading the parameters
            BasePrice basePrice = BasePrice.Close;

Re: forcing base price change the indicator calculations

The indicator is the original Moving average

Post's attachments

MovingAverage.cs 16.19 kb, 1 downloads since 2016-05-21 

You don't have the permssions to download the attachments of this post.

Re: forcing base price change the indicator calculations

and here is the indicator after modification

Post's attachments

MovingAverage - close.cs 16.19 kb, 2 downloads since 2016-05-21 

You don't have the permssions to download the attachments of this post.

Re: forcing base price change the indicator calculations

See my previous post!

Posts: 6

Pages 1

You must login or register to post a reply

Forex Forum → Technical Indicators → forcing base price change the indicator calculations

Similar topics in this forum