Alexander Elder’s Triple Screen Trading Strategy (Amibroker And Tradestation Code)

The original article can be found here.

The strategy in plain English:

  1. The close must be higher than the close 250 days ago (the long-term trend filter).
  2. The close must be higher than the close 22 days ago (the intermediate trend filter).
  3. The close today must be a three-day low (of the close).
  4. If 1-3 are true, then go long at the close.
  5. We sell at the close when the close is higher than yesterday’s close.

Amibroker code:

Buy= Close>Ref(C,-250) AND C>Ref(C,-22) AND C<Ref(LLV(C,3),-1); 
buyPrice=Close;
Sell= C>Ref(H,-1) ;
sellPrice=Close ;

Tradestation code:

{
Alexander Elder’s Triple Screen Trading Strategy
https://www.quantifiedstrategies.com/lessons/alexander-elders-triple-screen-trading-strategy/
}

Inputs:
	FastLookback(3),
	MediumLookback(22),
	SlowLookback(250);	

if C > C[SlowLookback] AND C > C[MediumLookback] AND C < Lowest(C, FastLookback)[1] Then
	buy this bar on close;
	
if C > H[1] Then
	sell this bar on close;