Good mornin. Is there someone who will read this post which is able to solve a problem with this code:
Inputs: HighValue(High), LowValue(Low), CloseValue(Close),Price(Close),Lenght(14),Strenght(75),Weaken(25);
If FastKCustom(HighValue, LowValue, CloseValue, Lenght ) crosses under
FastDCustom(HighValue, LowValue, CloseValue, Lenght) and FastDCustom(HighValue,
LowValue, CloseValue, Lenght) >= Strenght then Buy next bar at market;
If FastKCustom(HighValue, LowValue, CloseValue, Lenght ) crosses over
FastDCustom(HighValue, LowValue, CloseValue, Lenght) and FastDCustom(HighValue,
LowValue, CloseValue, Lenght) <= Weaken Then Sellshort next bar at market;
If MarketPosition = 1 Then Begin
Sell currentcontracts/2 at EntryPrice + averagetruerange(lenght) Limit;
Sell at Low[2] - .3 * averagetruerange(Lenght) Stop;
End;
If MarketPosition = -1 then Begin
BuytoCover currentcontracts/2 at EntryPrice - averagetruerange(Lenght) Limit;
Sell at High[2] + .3 * averagetruerange(Lenght) stop;
End;
All seems right bu when I compile powerLanguage returns me : Syntax error expecting 'bars'
Line0 Column 0
Thank you in advance
Problem about a strategy's code I cannot solve
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
-
- Posts: 401
- Joined: 19 Jan 2011
- Location: Netherlands
- Has thanked: 85 times
- Been thanked: 124 times
Re: Problem about a strategy's code I cannot solve
Edit your code somewhat
Code: Select all
Inputs:
HighValue(High),
LowValue(Low),
CloseValue(Close),
Price(Close),
Lenght(14),
Strenght(75),
Weaken(25);
Vars:
NumberOfContracts(0);
If FastKCustom(HighValue, LowValue, CloseValue,Lenght)
crosses under
FastDCustom(HighValue, LowValue, CloseValue,Lenght)
and
FastDCustom(HighValue, LowValue,CloseValue, Lenght) >= Strenght
then Buy next bar at market;
If FastKCustom(HighValue, LowValue, CloseValue, Lenght)
crosses over
FastDCustom(HighValue, LowValue, CloseValue, Lenght)
and
FastDCustom(HighValue, LowValue,CloseValue, Lenght) <= Weaken
Then Sellshort next bar at market;
NumberOfContracts = Currentcontracts * 0.5;
If MarketPosition = 1 Then Begin
Sell NumberOfContracts contracts next bar at (EntryPrice + averagetruerange(lenght) ) Limit;
Sell NumberOfContracts contracts next bar at (Low[2] - (0.3 * averagetruerange(Lenght)) ) Stop;
End;
If MarketPosition = -1 then Begin
BuytoCover NumberOfContracts contracts next bar at (EntryPrice - averagetruerange(Lenght)) Limit;
BuyToCover NumberOfContracts contracts next bar at (High[2] + (0.3 * averagetruerange(Lenght)) ) stop;
End;