I make 20 bar breakout system.
Perfomance ?
NO GOOD, bad!
This program has money management.
If you have good money management, Please tell me.
========================================
I want to try how recover this bad perfomance system with good money management.
This program is for Tradestation 2000i or (6?).
{*******************************************************************
Description : 20 bar Breakout System.
Perfomance ?
No good !!
nakayama@swingwaver.com
********************************************************************}
Inputs:
AccountSize(100000), {Account size [$]}
RiskPer(2.0), {Risk fraction [%]}
Length(20),
StopLength(10),
Stopfraction(3),
TSfraction(3);
Vars:
cont_lose(0),
entryflag(false),
PrevEquity(0),
NowAccount(0),
ii(0),Ntrades(0),
TrailStop(0),
PostionSize(0),
MMsize(0), {Money Management Positon size}
MMstop(0); {Money Management Stop}
Arrays:
Equity[100](0);
if Ntrades = 0 then begin { Initialize }
NowAccount = AccountSize/2;
end;
MMstop = Average(TrueRange,StopLength)*Stopfraction;
If MarketPosition = 0 and MMStop <> 0 then begin
value1=PositionProfit(1);
If value1 <> Equity[100] and value1 <> 0 then Begin {When New Trades}
{ Make room }
For ii=0 to 100-1 begin
Equity[ii] = Equity[ii+1];
end;
Equity[100]=value1; { New Profit or Loss}
NowAccount=NowAccount+Equity[100]; { New Account balance }
Ntrades = Ntrades + 1;
end;
MMsize = Round(NowAccount*RiskPer/100/MMstop,0);
ii = 0; cont_lose=0;
while Equity[100-ii] < 0 begin
if Equity[100-ii] < 0 then begin
cont_lose = cont_lose + 1;
end;
ii = ii + 1;
end;
if cont_lose >= 3 then begin
MMsize = Round(3*NowAccount*RiskPer/100/MMstop,0);
end;
{Entries}
If Close > Highest(Close,Length)[1] then begin
Buy ("UP") MMsize shares next bar at open;
end;
If Close < Lowest(Close,Length)[1] then begin
Sell ("Dw") MMsize shares next bar at open;
end;
end;
TrailStop = Average(Range,StopLength)*TSfraction;
{Exits}
{EntryPrie(0) is Open Entry Point}
If MarketPosition = 1 then begin
ExitLong ("MM LX stop") at EntryPrice(0)-MMStop on stop;
ExitLong ("TrailStop LX") at Highest(High,Length) - TrailStop on stop;
end;
If MarketPosition = -1 then begin
ExitShort ("MM SX stop") at EntryPrice(0)+MMStop on stop;
ExitShort ("TrailStop SX") at Lowest(Low,Length) + TrailStop on stop;
end;
Perfomance ?
NO GOOD, bad!
This program has money management.
If you have good money management, Please tell me.
========================================
I want to try how recover this bad perfomance system with good money management.
This program is for Tradestation 2000i or (6?).
{*******************************************************************
Description : 20 bar Breakout System.
Perfomance ?
No good !!
nakayama@swingwaver.com
********************************************************************}
Inputs:
AccountSize(100000), {Account size [$]}
RiskPer(2.0), {Risk fraction [%]}
Length(20),
StopLength(10),
Stopfraction(3),
TSfraction(3);
Vars:
cont_lose(0),
entryflag(false),
PrevEquity(0),
NowAccount(0),
ii(0),Ntrades(0),
TrailStop(0),
PostionSize(0),
MMsize(0), {Money Management Positon size}
MMstop(0); {Money Management Stop}
Arrays:
Equity[100](0);
if Ntrades = 0 then begin { Initialize }
NowAccount = AccountSize/2;
end;
MMstop = Average(TrueRange,StopLength)*Stopfraction;
If MarketPosition = 0 and MMStop <> 0 then begin
value1=PositionProfit(1);
If value1 <> Equity[100] and value1 <> 0 then Begin {When New Trades}
{ Make room }
For ii=0 to 100-1 begin
Equity[ii] = Equity[ii+1];
end;
Equity[100]=value1; { New Profit or Loss}
NowAccount=NowAccount+Equity[100]; { New Account balance }
Ntrades = Ntrades + 1;
end;
MMsize = Round(NowAccount*RiskPer/100/MMstop,0);
ii = 0; cont_lose=0;
while Equity[100-ii] < 0 begin
if Equity[100-ii] < 0 then begin
cont_lose = cont_lose + 1;
end;
ii = ii + 1;
end;
if cont_lose >= 3 then begin
MMsize = Round(3*NowAccount*RiskPer/100/MMstop,0);
end;
{Entries}
If Close > Highest(Close,Length)[1] then begin
Buy ("UP") MMsize shares next bar at open;
end;
If Close < Lowest(Close,Length)[1] then begin
Sell ("Dw") MMsize shares next bar at open;
end;
end;
TrailStop = Average(Range,StopLength)*TSfraction;
{Exits}
{EntryPrie(0) is Open Entry Point}
If MarketPosition = 1 then begin
ExitLong ("MM LX stop") at EntryPrice(0)-MMStop on stop;
ExitLong ("TrailStop LX") at Highest(High,Length) - TrailStop on stop;
end;
If MarketPosition = -1 then begin
ExitShort ("MM SX stop") at EntryPrice(0)+MMStop on stop;
ExitShort ("TrailStop SX") at Lowest(Low,Length) + TrailStop on stop;
end;
