Buy on Break of Pivot High

Questions about MultiCharts and user contributed studies.
Micardo
Posts: 7
Joined: 26 Feb 2011

Buy on Break of Pivot High

Postby Micardo » 13 Mar 2011

Hi,

I am still trying to get the following code to work.
inputs: Price( High ), LeftStrength( 3 ), RightStrength( 2 ) ;
{Uptrend Definition}
if XAverage(Close, 30) > XAverage(Close, 50) AND XAverage(Close, 50) > XAverage(Close, 100) then
{Buy Condition}
condition1 = PivotHighVSBar( 1, Price, LeftStrength, RightStrength, RightStrength + 1 ) <> -1 ;
value1 = PivotHighVSBar( 1, Price, LeftStrength, RightStrength, RightStrength + 1 );
if condition1
then
if Close > High[value1] then buy next bar at market;
As you can see I am using the already existing function PivotHighVSBar. My understanding of this function is that it returns a numeric value which is the amount of bars ago a pivot high occurred. So what I am trying to say is if the current close is higher than the previous high then buy. However even though the code compiles it doesn't ever buy.

Could someone please provide me with some feedback on this please? On where I may be going wrong.

Thank you for your help.

Micardo
Posts: 7
Joined: 26 Feb 2011

Re: Buy on Break of Pivot High

Postby Micardo » 13 Mar 2011

Hi,

One other thing. Yes I have tried this as an indicator and it plots in a sub window below the chart. Not on the actual chart like the real function, but in any case the values in the subchart are correct and are plotted, so I am not sure what the issue is.

Thanks

User avatar
TJ
Posts: 7266
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 992 times
Been thanked: 2063 times

Re: Buy on Break of Pivot High

Postby TJ » 13 Mar 2011

Hi,

One other thing. Yes I have tried this as an indicator and it plots in a sub window below the chart. Not on the actual chart like the real function, but in any case the values in the subchart are correct and are plotted, so I am not sure what the issue is.

Thanks
can you post your chart?

What variables you have plotted?

What variables you have verified?


Return to “MultiCharts”