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:

  1. Comparing data point to EMA note
  2. JForex Example: Not letting profit turn to losses with a breakeven stop
  3. A good trade that could have been great: a lesson to take profit at target
  4. Sold 200 LLL.TO @ 48.00, Profit +1.9%
  5. Sold 300 HOD.TO @ 9.40, Profit +0.5%

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>