forex software

Create and Test Forex Strategies

forex software

Skip to forum content

Forex Software

Create and Test Forex Strategies

You are not logged in. Please login or register.


Forex Software → Technical Indicators → Bar Range Price Spread Indicator

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 14

Topic: Bar Range Price Spread Indicator

I have been looking at developing an indicator that looks at the price spread over a number of bars for rising and falling trends, file attached. As I'm new to C# programming I've had to revert to decimal for the pips input as I had both short and long entry together. I would like to keep it standard. Could anyone help.
Thanks in anticipation

Post's attachments

Bar Range Price Spread.cs 5.45 kb, 33 downloads since 2012-02-12 

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

Re: Bar Range Price Spread Indicator

Since posting, had another look at it and have sorted the problem.
Mick

Re: Bar Range Price Spread Indicator

sounds to me like your looking for range bars....

Re: Bar Range Price Spread Indicator

I'm actually looking at an indicator that will allow me to monitor a price move over a set number of bars prior to a bar formation (e.g. a fractal). I haven't found an indicator in FSB that gives me that option. So my initial attempt above is to get it working measuring from bar 1 backward to a bar number set by the user or generator. Now I have it working I need to adjust the coding so I can input a position say measuring from bar 8 backwards to the set bar and also allowing me to set the price move over that period in time. I am now having problems trying to get the setting of the max min values of the bar range coded properly if they overlap I get an array alert when adjusting the settings in FSB. So at the moment I have set the bar range from 10 to the max and the measurement bar settings are 1 to 9.

Re: Bar Range Price Spread Indicator

Hi Jagmanmick,
This might help, indicators can use "Point" to convert from whole numbers to pips:
myInt * Point    // converts from int to pips
myInt / Point     // converts from pips to int

Re: Bar Range Price Spread Indicator

Maybe the code in the NR7 & NR4 logic conditions can be easily modified.

7 (edited by Jagmanmick 2012-02-17 00:39:05)

Re: Bar Range Price Spread Indicator

Hi krog/SpiderMan
I will have a look at both suggestions. Actually just multiplied by .00001 to get it to work, but I now want to make it so the I can set both the start and end points. Have had to set to limits so that the bars don't overlap otherwise a get the array fault. Version three attached. It does work well in this version but is restricted by the limits.
I am not sure how I can link the max of one range with the min of the other so they move up and down the range. (IndParam.NumParam[0].Min = 9; IndParam.NumParam[2].Max = 8;) I need these two linking together so they move together up and down the range.

Mick

Post's attachments

Bar Range Price Spread v3.cs 5.91 kb, 26 downloads since 2012-02-16 

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

Re: Bar Range Price Spread Indicator

Hey Mick,

Try these changes, should keep array in bound:

int iFirstBar = nBars + start + 1;
double    spread = price * Point;
for (int iBar = iFirstBar; iBar < Bars; iBar++)

As spread is converted to pips, remove the decimals.

Post your progress!

Re: Bar Range Price Spread Indicator

Jagmanmick wrote:

Hi krog/SpiderMan
I am not sure how I can link the max of one range with the min of the other so they move up and down the range. (IndParam.NumParam[0].Min = 9; IndParam.NumParam[2].Max = 8;) I need these two linking together so they move together up and down the range.
Mick

Hi Jagmanmick,
now I see it -- these won't show up until closing the Indicator dialog box and reopening. But, there is a workaround:
in // Reading parameters:

if (start >= nBars) {
    return;
}

It will return out and nothing in the indicator will calculate. I think there is some way to pop up a message to the user. But, I take the easy way out and add a note to the ToolTip, adding "\n This parameter must be greater than (the other parameter)".

or, should nBars be a fixed number greater than start? Then, make it start + (int)IndParam.NumParam[0].Value;  with a Parameter being how many bars to add, not the total number of bars.

hope that helps !!

Re: Bar Range Price Spread Indicator

Hi krog/footon,
Have modified the indicator to both your suggestions, array problems corrected decimals deleted.
Bar range settings can overlap but when they do the chart is blank, so I have changed the parameter box wording to reflect this as a reminder.
New version attached. Will post a strategy from it on the Strategy forum not sure the results are accurate.
Many Thanks for your help.
Mick

Post's attachments

Bar Range Price Spread v4.cs 6.17 kb, 61 downloads since 2012-02-17 

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

Re: Bar Range Price Spread Indicator

Great stuff! big_smile Glad to hear it worked out!

If you want overlap to produce results, I think if you remove Krog's suggestion, overlap will produce results, now it just pops out of calculation part, like Krog said.

Re: Bar Range Price Spread Indicator

Hello
i just came across your programed spread indicator but i donot understand the settings what means start bar and what means the figure for the spread  Is the figure equal to the points eg 1,2354  and a spread of 3 means 1.2357 right or not.??

Another very good indicator very similar to this one would be the inclination in degrees of a MA over a set bar range eg trading is allowed if the angle is higher / lower thän a certain degrees. That would eliminate the idling trades in any level of currency

Re: Bar Range Price Spread Indicator

Start Bar is the bar working back from the current bar. The spread is the price change from that bar to current bar.

Re: Bar Range Price Spread Indicator

Othello wrote:

Another very good indicator very similar to this one would be the inclination in degrees of a MA over a set bar range eg trading is allowed if the angle is higher / lower thän a certain degrees. That would eliminate the idling trades in any level of currency

This idea looks to be more a trendline over time indicator.
The idea behind my indicator is it also works over time depending on time scale, looking at the price move over a number of bars (gives a time frame) and by specifying the start and finish bars ignores what goes on in between.
Mick

Posts: 14

Pages 1

You must login or register to post a reply

Forex Software → Technical Indicators → Bar Range Price Spread Indicator

Similar topics in this forum