I am still trying to get the following code to work.
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.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;
Could someone please provide me with some feedback on this please? On where I may be going wrong.
Thank you for your help.