Index Futures Scalping System for ThinkorSwim

BenTen

BenTen

Administrative
Staff
VIP
Came across this archive in the thinkScript Lounge:

12:48 Mobius: I was recently asked to work up a scalping system for index futures trading. I agreed to do so as long as it could be shared. The criteria was

1) 1 to 3 point trades avg.
2) clear signals
3) 60% or better win rate

The trading method would be based on 2 contract entries. Risk defined by user but typically 2 to make 2. Risk Off defined by user but typically 2 points for one off and one runner. Sell signal for trade off at latest. I've been testing this for about a month. It works well with /ES. I've not tested it with anything else. Here is the study:


Code:
# Scalper
# Mobius
# V01.01
# Notes: Area between red and green horizontal plot lines (gray continuous cloud plot) represents body of trend. Area above and below red and green horizontal  plot lines represents tail accumulation and distribution. Price will be more volitile in tails. Trading at signals is good for quick scalping trades.

input n = 8;
input averageType = AverageType.WILDERS;
input upper = 90;
input lower = 10;
input signals = yes;

def h = high;
def l = low;
def c = close;
def x = barNumber();
def nan = double.nan;
script Range
    {
     input c = close;
     input n = 8;
     def Min = lowest(close, n);
     def Max = highest(close, n);
     def hh = Highest(c, n);
     def ll = Lowest(c, n);
     plot R = (((Max - Min) * (c - ll)) /  (hh - ll)) + Min;
    }
def a = close;
def b = CompoundValue(1, b[1] + (a-b[1]) / (n * Power(a/b[1], 4)), a);
def Avg = MovingAverage(averageType, b-b[1], n);
def AbsAvg = MovingAverage(averageType, AbsValue(b-b[1]), n);
def R = Avg / AbsAvg;
def Lpivot;
def Lbar;
def Hpivot;
def Hbar;
if 50 * (R + 1) crosses below lower
    {
     Lpivot = h;
     Lbar = x;
    }
else
    {
     Lpivot = Lpivot[1];
     Lbar = Lbar[1];
    }
if 50 * (R + 1) crosses above upper
    {
     Hpivot = l;
     Hbar = x;
    }
else
    {
     Hpivot = Hpivot[1];
     Hbar = Hbar[1];
    }
plot st = Range(50 * (R + 1), n);
     st.SetLineWeight(2);
     st.AssignValueColor(if 50 * (R + 1) < lower
                         then color.red
                         else if 50 * (R + 1) > upper
                         then color.green
                         else color.light_gray);
     st.HideBubble();
     st.HideTitle();
plot lp = if x >= highestAll(Lbar)
          then highestAll(if isNaN(c[-1])
                          then Lpivot
                          else nan)
          else nan;
     lp.SetLineWeight(2);
     lp.SetDefaultColor(Color.Green);
     lp.HideBubble();
     lp.HideTitle();
plot hp = if x >= highestAll(Hbar)
          then highestAll(if isNaN(c[-1])
                          then Hpivot
                          else nan)
          else nan;
     hp.SetlineWeight(2);
     hp.SetDefaultColor(Color.Red);
     hp.HideBubble();
     hp.HideTitle();
addCloud(lp, st, color.light_red, color.gray);
addCloud(st, hp, color.light_green, color.gray);
plot upSignal = if signals and
                   50 * (R + 1) crosses above lower
                then l - (3*tickSize())
                else nan;
     upSignal.SetPaintingStrategy(PaintingStrategy.Arrow_UP);
     upSignal.SetLineWeight(3);
     upSignal.SetDefaultColor(Color.Green);
     upSignal.HideBubble();
     upSignal.HideTitle();
plot up2Signal = if signals and
                   50 * (R + 1) crosses above upper
                then l - (5*tickSize())
                else nan;
     up2Signal.SetPaintingStrategy(PaintingStrategy.Arrow_UP);
     up2Signal.SetLineWeight(1);
     up2Signal.SetDefaultColor(Color.Cyan);
     up2Signal.HideBubble();
     up2Signal.HideTitle();
plot dnSignal = if signals and
                   50 * (R + 1) crosses below upper
                then h + (3*tickSize())
                else nan;
     dnSignal.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN);
     dnSignal.SetLineWeight(3);
     dnSignal.SetDefaultColor(Color.Red);
     dnSignal.HideBubble();
     dnSignal.HideTitle();
plot dn2Signal = if signals and
                   50 * (R + 1) crosses below lower
                then h + (5*tickSize())
                else nan;
     dn2Signal.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN);
     dn2Signal.SetLineWeight(1);
     dn2Signal.SetDefaultColor(Color.Magenta);
     dn2Signal.HideBubble();
     dn2Signal.HideTitle();
# End Code Scalper
A couple of notes from Mobius, the developer of this script:

12:49 Mobius: As always I suggest living with any study for a while until you understand it before trading it.

12:51 Mobius: The signals will not repaint. And they are not early or late. So you need to be comfortable pulling the trigger when you see the signal. It's scalping and thinking too much.

12:55 Mobius: I've been able to easily clear 6 to 10 points a day with that study over the testing period. With few bad trades more than a couple points

12:56 Mobius: Seems best trades are out of the gate at RTH open

12:57 Mobius: spoke.. I'll use 2min, 5min and 15min depending on how volatile the market is

13:00 Mobius: Good clue on how volatile the market is, is ORB. if the range is 10 points or less the market is probably melting up and 15min is easier. If 20 points or so 5min. Large Opening Ranges of 40 or 50 points and 2min and it's wise to lighten up in risk. I'll often trade down to 2 contracts if the market is super volatile. Even add to positions of we're getting 10point bars
 
K

krsheath

New member
VIP
Question - Do you short below the arrow or below the RED Line and same for GREEN ARROW AND GREEN LINE. . As I notice the arrow appears once it's already down. So I would like know you're thoughts ..Thank You for this great community.

 
Last edited:
BenTen

BenTen

Administrative
Staff
VIP
@sbwcws I'm not too sure honestly. I hope there would be more to the indicator. But I was only able to locate a couple comments from Mobius which I already included above.

# Notes: Area between red and green horizontal plot lines (gray continuous cloud plot) represents body of trend. Area above and below red and green horizontal plot lines represents tail accumulation and distribution. Price will be more volitile in tails. Trading at signals is good for quick scalping trades.
 
D

dominos101

New member
VIP
@sbwcws I'm not too sure honestly. I hope there would be more to the indicator. But I was only able to locate a couple comments from Mobius which I already included above.
So do you just go long and short at every arrow?
 
D

donger

New member
Hi BenTen!

I have been testing this indicator out with moderate success. Thanks for sharing!

I am trying to add an alert for this every time an up arrow or down arrow prints. This is what I've tried so far with no success:

Alert(condition = upSignal or up2Signal, text = "Buy Signal", sound = Sound.Ring, "alert type" = Alert.BAR);

Alert(upSignal[1] or up2Signal[1], text = "Buy Signal", sound = Sound.Ring, "alert type" = Alert.BAR);

Alert(upSignal, "BUY", Alert.BAR, Sound.RING);

Alert(condition = upSignal, "BUY", Alert.BAR, Sound.RING);

Can you let me know what I am doing wrong? I'm a newbie at coding/thinkscript and I can't figure out what's wrong. Thanks!
 
BenTen

BenTen

Administrative
Staff
VIP
@donger This should work:

Code:
# Alerts
Alert(upSignal, " ", Alert.Bar, Sound.Chimes);
Alert(up2Signal, " ", Alert.Bar, Sound.Bell);
Alert(dnSignal, " ", Alert.Bar, Sound.Chimes);
Alert(dn2Signal, " ", Alert.Bar, Sound.Bell);
 
B

barbaros

Member
I wonder what the difference is between upSignal and up2Signal, and dnSignal and dn2Signal.
 
MerryDay

MerryDay

Member
VIP
@barbaros
"Area between red and green horizontal plot lines (gray continuous cloud plot) represents body of trend. Area above and below red and green horizontal plot lines represents tail accumulation and distribution."
upSignal and dnSignal are when price crosses green line
up2Signal and dn2Signal are when price crosses redline
 

Similar threads

Top