SPX Trading Strategy for ThinkorSwim

Status
Not open for further replies.
Perhaps if you were to explain how you are entering and exiting trades, with risk control, we could be of further assistance... Any images of trades on charts would also be beneficial... I honestly don't see how having a 63% success rate could result in a negative profit...

Thank you rad14733. I know why I lost. First of all, I don't have a good entering strategy. So I need to learn indicators first. Secondly, though I won more than lost, what I lost were high premium trades. So I need to learn risk control as well. There is a lot to learn. Glad to know MCDBB :)
 

New Indicator: Buy the Dip

Check out our Buy the Dip indicator and see how it can help you find profitable swing trading ideas. Scanner, watchlist columns, and add-ons are included.

Download the indicator

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

You can sign up at ninjatrader.com its free. I have coded part of this. If you post the conditions for long or short and how you want to manage the trade ie stops and profit targets i will work with you.
I can also assist with ninjatrader. I've only been using their free stuff and I have been able to write indicators and strategies (and backtest/optimize the strategies).
 
@2pointcorrelation Re-read @Hypoluxa's first post in this topic for proper use of this strategy until it makes sense... And remember, the trade is either there or it isn't... You can't second-guess and think that a trade will develop that isn't currently presenting itself... And if the setup doesn't look strong from the start then sit it out and wait for a setup that is... While I m not currently trading this strategy at the moment I understand it well and use a similar methodology in my current system that is still being honed to my needs...

Scalping can be summed up in one word - momentum... Scalping isn't entering a weak trade and allowing it to languish over an extended period of time... If it doesn't move as expected, exit and wait for a better setup... Being too stubborn to exit a trade at a small profit, or small loss, is just a recipe for increased loss...

I think you get my point... ;)
 
I can also assist with ninjatrader. I've only been using their free stuff and I have been able to write indicators and strategies (and backtest/optimize the strategies).
Are you being able to do super dom related actions in C#? I thought that functionality is only for paid platform.
 
That’s awesome! 👊👊
Added the alert lines at the bottom. I am not a programmer, but just wanted to show you that it is not that hard. I have not tested the alerts or logic.

Code:
# TS_MACD_BB
# By Eric Purdy, ThinkScripter LLC
# http://www.thinkscripter.com
# [email protected]
# Last Update 07 Feb 2011
# https://usethinkscript.com/threads/macd-with-bollinger-bands-bb-indicator-for-thinkorswim.287/post-1632

declare lower;

input price = close;
input BBlength = 10;
input BBNum_Dev = 1;
input MACDfastLength = 12;
input MACDslowLength = 26;
input MACDLength = 5;

def MACD_Data = MACD(fastLength = MACDfastLength, slowLength = MACDslowLength, MACDLength = MACDLength);

plot MACD_Dots = MACD_Data;
plot MACD_Line = MACD_Data;

plot BB_Upper = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).UpperBand;
plot BB_Lower = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).Lowerband;
plot BB_Midline = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).MidLine;

BB_Upper.SetDefaultColor(Color.GRAY);
BB_Lower.SetDefaultColor(Color.GRAY);
BB_Midline.SetDefaultColor(Color.GRAY);
BB_Midline.SetStyle(Curve.SHORT_DASH);

#MACD_Line.SetDefaultColor(Color.WHITE);

#MACD_Dots.SetStyle(Curve.POINTS);
#MACD_Dots.SetLineWeight(2);
#MACD_Dots.AssignValueColor(if MACD_Line > MACD_Line[1] then Color.White else Color.DARK_RED);

MACD_Line.AssignValueColor(if MACD_Line > MACD_Line[1] and MACD_Line >= BB_Upper then Color.GREEN else if MACD_Line < MACD_Line[1] and MACD_Line >= BB_Upper then Color.DARK_GREEN else if MACD_Line < MACD_Line[1] and MACD_Line <= BB_Lower then Color.RED else if MACD_Line > MACD_Line[1] and MACD_Line <= BB_Lower then Color.DARK_RED else Color.GRAY);
MACD_Line.SetLineWeight(1);

MACD_Dots.AssignValueColor(if MACD_Line > MACD_Line[1] and MACD_Line > BB_Upper then Color.GREEN else if MACD_Line < MACD_Line[1] and MACD_Line > BB_Upper then Color.DARK_GREEN else if MACD_Line < MACD_Line[1] and MACD_Line < BB_Lower then Color.RED else if MACD_Line > MACD_Line[1] and MACD_Line < BB_Lower then Color.DARK_RED else Color.GRAY);
MACD_Dots.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
MACD_Dots.SetLineWeight(2);

plot zero = 0;
zero.AssignValueColor(if MACD_Line < 0 then Color.RED else Color.GREEN);
zero.SetLineWeight(2);

#Alerts
#alert( MACD_Dots > 0 and MACD_Dots[1] <=0, "Buy", alert.ONCE,sound.DING);
alert(crosses(MACD_Dots, zero, CrossingDirection.ABOVE) , "Buy", alert.ONCE,sound.RING);
alert(crosses(MACD_Dots, zero, CrossingDirection.BELOW) , "SELL", alert.ONCE,sound.RING);
 
Are you being able to do super dom related actions in C#? I thought that functionality is only for paid platform.
No. I cannot do Super-DOM.
Executing the advanced actions like Automated Trade Management (ATM) and what-not are within the paid platform.

Even though I'm only using the free version, I can still write indicators and strategies, and I can do strategy analyzer for backtesting and optimizations by leveraging historical data that I downloaded previously. If Advanced order functionality needs to be tested, I can't be that guinea pig for a few days to a week: there is lag time for setting up accounts because It's a multi-step with ninjatrader, as they only have broker, you have to go elsewhere for futures clearing merchant (FCM).
 
No. I cannot do Super-DOM.
Executing the advanced actions like Automated Trade Management (ATM) and what-not are within the paid platform.

Even though I'm only using the free version, I can still write indicators and strategies, and I can do strategy analyzer for backtesting and optimizations by leveraging historical data that I downloaded previously. If Advanced order functionality needs to be tested, I can't be that guinea pig for a few days to a week: there is lag time for setting up accounts because It's a multi-step with ninjatrader, as they only have broker, you have to go elsewhere for futures clearing merchant (FCM).
@barbaros, @tradecombine - If needed I can help test on NT8 (or 7). I have a lifetime license.
 
Added the alert lines at the bottom. I am not a programmer, but just wanted to show you that it is not that hard. I have not tested the alerts or logic.

Code:
# TS_MACD_BB
# By Eric Purdy, ThinkScripter LLC
# http://www.thinkscripter.com
# [email protected]
# Last Update 07 Feb 2011
# https://usethinkscript.com/threads/macd-with-bollinger-bands-bb-indicator-for-thinkorswim.287/post-1632

declare lower;

input price = close;
input BBlength = 10;
input BBNum_Dev = 1;
input MACDfastLength = 12;
input MACDslowLength = 26;
input MACDLength = 5;

def MACD_Data = MACD(fastLength = MACDfastLength, slowLength = MACDslowLength, MACDLength = MACDLength);

plot MACD_Dots = MACD_Data;
plot MACD_Line = MACD_Data;

plot BB_Upper = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).UpperBand;
plot BB_Lower = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).Lowerband;
plot BB_Midline = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).MidLine;

BB_Upper.SetDefaultColor(Color.GRAY);
BB_Lower.SetDefaultColor(Color.GRAY);
BB_Midline.SetDefaultColor(Color.GRAY);
BB_Midline.SetStyle(Curve.SHORT_DASH);

#MACD_Line.SetDefaultColor(Color.WHITE);

#MACD_Dots.SetStyle(Curve.POINTS);
#MACD_Dots.SetLineWeight(2);
#MACD_Dots.AssignValueColor(if MACD_Line > MACD_Line[1] then Color.White else Color.DARK_RED);

MACD_Line.AssignValueColor(if MACD_Line > MACD_Line[1] and MACD_Line >= BB_Upper then Color.GREEN else if MACD_Line < MACD_Line[1] and MACD_Line >= BB_Upper then Color.DARK_GREEN else if MACD_Line < MACD_Line[1] and MACD_Line <= BB_Lower then Color.RED else if MACD_Line > MACD_Line[1] and MACD_Line <= BB_Lower then Color.DARK_RED else Color.GRAY);
MACD_Line.SetLineWeight(1);

MACD_Dots.AssignValueColor(if MACD_Line > MACD_Line[1] and MACD_Line > BB_Upper then Color.GREEN else if MACD_Line < MACD_Line[1] and MACD_Line > BB_Upper then Color.DARK_GREEN else if MACD_Line < MACD_Line[1] and MACD_Line < BB_Lower then Color.RED else if MACD_Line > MACD_Line[1] and MACD_Line < BB_Lower then Color.DARK_RED else Color.GRAY);
MACD_Dots.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
MACD_Dots.SetLineWeight(2);

plot zero = 0;
zero.AssignValueColor(if MACD_Line < 0 then Color.RED else Color.GREEN);
zero.SetLineWeight(2);

#Alerts
#alert( MACD_Dots > 0 and MACD_Dots[1] <=0, "Buy", alert.ONCE,sound.DING);
alert(crosses(MACD_Dots, zero, CrossingDirection.ABOVE) , "Buy", alert.ONCE,sound.RING);
alert(crosses(MACD_Dots, zero, CrossingDirection.BELOW) , "SELL", alert.ONCE,sound.RING);
Thanks a lot! I’ll try it out today!
 
Equity curve for /ES is not looking too consistent. I think you should be cautious with your exists, and look at lower timeframes if you are directly trading /ES.

Since option pricing sometimes moves differently, SPX with options might be different. I am not aware of a way to script the option backtest with ToS, so n/a right now.

Following is the default settings with the indicator tested on /ES for past 6 months. It is doing well since mid-November-ish of last year, but struggled until that time.
vvq2ddr.png


Runners with MACD is another story. If you are going to use it, I think this should be treated as the lottery ticket in this strategy. There could be stoploss methods that might minimize the drawdowns, or it can wipe out gains quickly.
jARU41h.png


I have been working on optimizing the parameters with some success. I'll share if there is a breakthrough. Let me know if you have any suggestions.
 
Equity curve for /ES is not looking too consistent. I think you should be cautious with your exists, and look at lower timeframes if you are directly trading /ES.

Since option pricing sometimes moves differently, SPX with options might be different. I am not aware of a way to script the option backtest with ToS, so n/a right now.

Following is the default settings with the indicator tested on /ES for past 6 months. It is doing well since mid-November-ish of last year, but struggled until that time.
vvq2ddr.png


Runners with MACD is another story. If you are going to use it, I think this should be treated as the lottery ticket in this strategy. There could be stoploss methods that might minimize the drawdowns, or it can wipe out gains quickly.
jARU41h.png


I have been working on optimizing the parameters with some success. I'll share if there is a breakthrough. Let me know if you have any suggestions.
with the runner what is ur 1 c scalp target?
 
with the runner what is ur 1 c scalp target?
Runner does't include the scalp target. ToS limitation. So, 2 separate outputs. But, you can kinda see that since beginning of December last year, this strategy has been doing well. Will it continue this way, that's unknown.
 
Runner does't include the scalp target. ToS limitation. So, 2 separate outputs. But, you can kinda see that since beginning of December last year, this strategy has been doing well. Will it continue this way, that's unknown.
only time will tell. thanks for your study
 
Status
Not open for further replies.

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
264 Online
Create Post

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top