3-MA crossovers, claimed 1.84 profit factor
Saw a forum post on TS claiming 1.84 proft factor. The concept seems interesting. Here is the code for later study. Here is the link to the post.
[ IntraBarOrderGeneration = False ]
Inputs:
EMAFastLength(4),
EMAMedLength(5),
EMASlowLength(22),
ValidBars(2);
Variables:
EMAFast(0),
EMAMed(0),
EMASlow(0),
BuyHighAmt(0),
LSetUp(False),
LSetCount(0);
{ Calculation Section }
EMAFast = XAverage(Close,EMAFastLength);
EMAMed = XAverage(Close,EMAMedLength);
EMASlow = XAverage(Close,EMASlowLength);
{ Define Entry SetUp Conditions }
If EMAFast crosses above EMAMed and EMAMed > EMASlow then
begin
BuyHighAmt = High+ 1 point;
LSetUp = True;
LSetCount = 1;
end;
If EMAMed crosses above EMASlow and EMAFast > EMASlow then
begin
BuyHighAmt = High + 1 point;
LSetUp = True;
LSetCount = 1;
end;
{ Entry SetUp is Valid – Make Long Entry if BuyHighAmt is reached }
If LSetUp and (TradesToday(Date) = 0 or (MarketPosition = 1 and PositionProfit > CurrentContracts*45))
Buy next bar at BuyHighAmt stop;
{ SetUp Failed or Long Entry Was Made – Reset Entry Conditions }
LSetCount = LSetCount + 1 ;
//If LSetCount > ValidBars or MarketPosition = 1 then {allows only one entry}
If LSetCount > ValidBars or BarsSinceEntry <= ValidBars then {replace this line with above line to allows only one entries in the same direction} begin BuyHighAmt = 9999; LSetUp = False; LSetCount = 0; end; // end of code //
Related posts:

Recent Comments