Traders Laboratory - View Single Post - Custom Scalper Buy/Sell
View Single Post
  #2 (permalink)  
Old 07-04-2007, 01:15 PM
biegea biegea is offline
biegea has no status.

 
Join Date: Jul 2007
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
Re: TTM Scalper Buy/Sell

Torero, it works on any timeframe. My approximate percentages were based on charts I compared it to in various TTM videos.

Dovetree, here's the code:
inputs: BarWidth(3); variables: UpTrend(false), LowPainted(false), HighPainted(false), ExtremeBar(0), TriggerBarLow(0), ExtremeBarHigh(0), TriggerBarHigh(0), ExtremeBarLow(0), counter(-1); // Compare the 9-period MA to the previous bar's value as the basis for determining // if we are in an uptrend or a downtrend at this moment. // // We will NOT check for the presence of a trend if we are // "waiting for a confirmation of a trigger (i.e. Extreme Bar <> 0)" ?? //Downtrend -- Look to paint a low bar if (AverageFC(Close[3],9) < AverageFC(Close[4],9) and ExtremeBar=0) or ((AverageFC(Close[3],9) = AverageFC(Close[4],9) and ExtremeBar=0) and (UpTrend=False)) then begin UpTrend=False; HighPainted=false; if low[3] > low then LowPainted=false; end; //Uptrend -- Look to paint a high bar if AverageFC(Close[3],9) > AverageFC(Close[4],9) and ExtremeBar=0 or ((AverageFC(Close[3],9) = AverageFC(Close[4],9) and ExtremeBar=0) and (UpTrend=True)) then begin UpTrend=True; LowPainted=false; if high[3] < high then HighPainted=false; end; //Check for triggers and paint the extreme bar on confirmation //Uptrend if UpTrend = True and HighPainted=false then begin if high[2] < high[3] and ExtremeBar=0 then begin ExtremeBar = 3; ExtremeBarHigh = high[3]; TriggerBarLow = low[2]; end; if high[1] > ExtremeBarHigh then begin ExtremeBar = 0; ExtremeBarHigh = 0; TriggerBarLow = 0; counter=-1; end; if ExtremeBar <> 0 then counter=counter+1; // Paint an "Extreme Bar" if it exists based on the two if blocks above // OR if the earlier close was above the 8-EMA and the later close was // below the 8-EMA) if (close[1] < TriggerBarLow and ExtremeBar <> 0) // or ((Close[3] > XAverage(Close[3],8)) and (Close[1] < XAverage(Close[1],8))) then begin ExtremeBar = ExtremeBar + counter; PlotPaintBar[ExtremeBar](High[ExtremeBar],Low[ExtremeBar],"ScalperSig",white); SetPlotWidth[ExtremeBar](1,BarWidth); SetPlotColor[ExtremeBar](1,white); alert("Scalper Sell Detected!"); HighPainted = true; counter=-1; ExtremeBar=0; end; end; //Downtrend if UpTrend = False and LowPainted=false then begin if low[2] > low[3] and ExtremeBar=0 then begin ExtremeBar = 3; ExtremeBarLow = low[3]; TriggerBarHigh = high[2]; if ExtremeBarLow > low[4] then ExtremeBar = 4; end; if low[1] < ExtremeBarLow then begin ExtremeBar = 0; ExtremeBarLow = 0; TriggerBarHigh = 0; counter=-1; end; if ExtremeBar <> 0 then counter=counter+1; if close[1] > TriggerBarHigh and ExtremeBar <> 0 then begin ExtremeBar = ExtremeBar + counter; PlotPaintBar[ExtremeBar](Low[ExtremeBar],High[ExtremeBar],"ScalperSig",white); SetPlotWidth[ExtremeBar](1,BarWidth); SetPlotColor[ExtremeBar](1,white); alert("Scalper Buy Detected!"); LowPainted = true; counter=-1; ExtremeBar=0; end; end;

Reply With Quote