Click here to Login

                                                   Stop Loss for Intraday Trading System


Matt Johnson
2016-07-15 14:34:11

I am looking for a way to code the stop loss so that the system sells/covers on the last bar of the day to avoid overnight positions. I am using 1-min data for the trading system. Any help would be greatly appreciated.

Matt Johnson
2016-07-15 15:20:07


Also, would like to add some code that prohibits entering a new trade on the last trading bar of the day. Thanks in advance for any help!

2016-07-16 04:51:20


To detect the last bar of a day, you can use this formula:
lb =day() != ref(day(), -1);

You can just use that rule in your sell and buy rules.

buy = rsi(14) > 70 and !lb;
sell = lb;

You also need to add this to execute the order at the close:
SetSimTiming(_Sell, _Close, -1);

No more messages


No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"


Trading Items
Stop Loss for the N-first Trading Bars only
Adaptive Trading System - Percent Winning Trades for the Last N-D...
Intraday Trading System with Daily Ranking
Tax Implications for Your Trading System
Optimizable Fibonacci Long and Short Trading System

How-to Lessons
How to optimize the stop limit of a trading system
How to optimize the number of positions in a trading system
How to set order type of a trading system programmatically
How to add a metric in the trading system simulation report
How to debug a trading system using the money management tool

Related Forum Threads
Setting stop loss for each trade
Trading System Target Profit and Loss prices
Stop Loss effective only for 1st 2 bar of order ..
Ranking System - Intraday support
Optimize ranking system within a trading system?

Blog Posts
Day Trading: A trading system that combines intraday and EOD data
How to Backtest an Intraday Stock Trading System with EOD Ranking
How to Select the Best Market Indicator for your Trading System
How to Backtest Your Trading System for Each Industry
How to Create an Automated Trading System in QuantShare

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2024
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.