Camelback strategy

Anyone heard of the camelback?

"The Camelback trading technique comes from Joe Ross’ trading manual. Its uses a moving average channel and an exponential moving average to keep traders on the right side of the market."

I gave it a chance and this is what I came up with. Want to share it with you and would appreciate comments and if you have experienced it.

As you can see from the code I use it of for other strategies too.

camelback example

(rightclick the image and "Open image in new tab")

function thisIsLastBar() { return  BarIndex() == LastValue(BarIndex()) ; } 

function Setup_Camelback()
{

	buy_setup =
	(
	    // trendfilter
		L >= MA(H,40)	AND 
		( EMA(C,14) > Ref( EMA(C,14), -1) )	
		
		
		AND
        // setups
		(
			TroughBars(L,0.5,1) == 0 	OR
			( thisIsLastBar() AND L < Ref(L,-1) )	
		)
	);
	
	
	
    // If we have setup yesterday and inside day today then this 
    // is still a setup
    buy_setup = buy_setup 
                OR 
                (
                    REF(buy_setup, -1) 
                    AND 
                    ( EMA(C,14) > Ref( EMA(C,14), -1) )	
                    
                    AND
                    (
                        Inside() OR
                        H == REF(H,-1) AND L > REF(L,-1)
                    )
                );	


	buy_setup_confirmed = Ref(buy_setup, -1) AND H > Ref(H,-1); 


	sell_setup =
	(
	    // trendfilter
		H <= MA(L,40) AND 
		( EMA(C,14) < Ref( EMA(C,14), -1) ) 
		
		AND
		// setups
		(
		    PeakBars(H,0.5,1) == 0  OR
			( thisIsLastBar() AND H > Ref(H,-1) )	
		)
	);


    // If we have setup yesterday and inside day today then this 
    // is still a setup
    sell_setup = sell_setup 
                OR 
                (
                    REF(sell_setup, -1) 
                    AND 
                    ( EMA(C,14) < Ref( EMA(C,14), -1) )	
                    
                    AND
                    (
                        Inside() OR
                        L == REF(L,-1) AND H < REF(H,-1)
                    )
                );	


	sell_setup_confirmed = Ref(sell_setup, -1) AND L < Ref(L,-1); 


	return
			IIf( buy_setup AND buy_setup_confirmed, 3
			, IIf( buy_setup_confirmed, 2
			, IIf( buy_setup, 1
			, IIf( sell_setup AND sell_setup_confirmed, -3
			, IIf( sell_setup_confirmed, -2
			, IIf( sell_setup, -1
			, 0 ))))));
}


//-----------
// Plot setup signals from a strategy. The following 
// is plotted:
//      - a bar graph
//      - buy setup signal
//      - buy setup is confirmed
//      - sell setup signal
//      - sell setup is confirmed
//
// This is the meaning of the inparameter "sig" values:
//      0       no setup and no confirm
//      1, -1   setup
//      2, -2   setup is confirmed
//      3, -3   both setup and confirm 
//
// In case 3, -3 the setup is today and the confirm is for yesterdays setup.
//

procedure Plot_Setup_Signals( sig )
{
		// Plot arrows at the buy-setup's
	PlotShapes( 	IIf( sig == 1 OR sig == 3, shapeUpArrow, shapeNone )
			, colorBlue
			, 0
			, L
			, -20 ); 


	// Plot arrows at the sell-setup's
	PlotShapes( 	IIf( sig == -1 OR sig == -3, shapeDownArrow, shapeNone )
			, colorRed
			, 0
			, H
			, -20 ); 


	// Plot the bar graph and mark those bars where the setup is confirmed
	PlotOHLC(	Open
			, High
			, Low
			, Close 
			,""
			, IIf(  sig == 2 OR sig == -2 OR sig == 3 OR sig == -3
			        , colorYellow
			        , colorBrightGreen)
			, styleBar); 
}


_SECTION_BEGIN("indicator_setup_camelback");

Plot (H*1.010,"",colorBlack,16+4096 ); 
Plot (L*0.990,"",colorBlack,16+4096); 

Plot(MA(H, 40), "", colorBrown, styleLine);
Plot(MA(L, 40), "", colorBrown, styleLine);
Plot(EMA(C, 14), "", colorGrey50, styleLine);

Plot_Setup_Signals( Setup_Camelback() );
_SECTION_END();

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.