Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

ONE-

Time Delay (to Avoid Whipsaw) for EasyLanguage / PowerLanguage?

Recommended Posts

Hello,

 

I am having trouble coding a time delay after a trade occurs (buy or sell, open or close) to avoid my automated strategy making a ton of trades as the price action whipsaws and signals my indicators true/false. Can anyone provide some suggestions here?

 

For instance, (I will set a time delay of say 15 minutes)... if my combo of indicators goes true at 10:20AM and a Long position is opened, I don't want these indicators to be evaluated again before 10:35AM. I want my strategy to run in real time and not on bar close b/c of the action I'm missing in that bar. However, right now all that my strategy will do is rack up commission fees.

 

Any help is greatly appreciated! I'm using Multicharts.

 

Thanks!!

Share this post


Link to post
Share on other sites

I think the following should work, although I'm not at a computer with TradeStation on at the minute so I can't check it. And if you give it a couple of days a better programmer than me will post a better method!

 

The number of bars will prescribe the time delay before new orders are considered (i.e. if you leave this set to 3 then this will cause a 15 minute delay on a five minute chart or a 45 minute delay on a 15 minute chart).

 

Inputs:
TimeDelayBars(3);

Variables:
BarsSinceLastEntry(0);

If Marketposition<>0 then
BarsSinceLastEntry=Barssinceentry
Else
BarsSinceLastEntry=BarsSinceLastEntry[1]+1;

If BarsSinceLastEntry>=TimeDelay then begin

{ whatever it is you’re wanting to do following a time delay goes here }

End;

 

Another approach might just be to create a lagging or 'displaced' set of indicators.

 

Hope that's helpful.

 

BlueHorseshoe

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Similar Content

    • By marty_trader
      found this link over on EliteTrader and loved it. Very inspiring for someone like me who is building my own trading code from the ground up 
      what are your thoughts on this?
      https://fxgears.com/index.php?threads/python-development-environment-jacks-technology-stack.1090/
      guy writes an algo platform from scratch in python and connects it to multiple brokers and data sources               nutz
    • By TopAlgo
      Algo Trading During Trump Iran Deal
      05/08/2018 Algo trading 15 contracts per trade, profit 17k
      www.topalgo.com
    • By TopAlgo
      What is Top Algo?
      We provide top of the line custom futures trading strategy for the Topstep Trader™ Combine and live trading. Our automated strategy is built to successfully pass both steps of the Trading Combine® and continue being used in live trading.

      Step 1 - Sign Up With TopstepTrader.com
      The TopstepTrader Trading Combine® is a real-time simulated account where your performance is evaluated across two steps for the opportunity to get funded with our trading capital. Once you reach the Profit Target without breaking any rules, your Funded Account™ will be waiting.
      Sign up with TopstepTrader.com HERE
      Learn more about becoming a fully funded trader with Topstep Trader HERE
      * Note- you will need to select Ninjatrader as your trading platform

      Step 2 - Use Our Algorithmic Trading Strategy
      Our fully automated trading strategy is built for the NinjaTrader 7 Platform and trades exclusively WTI Crude Futures Contracts. It allows the trader to stay within the Trading Combine® rules while making profitable trades and spending less time in front of the screen.

      Step 3 - Get Funded Trade Live
      Once you pass the Trading Combine® our life time license allows you to continue using our trading system with no limit on # of contracts it trades.
       
      Visit our site for more info topalgo.com
    • By trading4life
      Hello, My name is trading4life.
      I just joined this forum.
  • Topics

  • Posts

    • The only thing I'd disagree with is "compared to a trend following approach." Many Ultra systems were fully or partially trend-following.  And I haven't seen any trend-following systems (not counting over-optimized with little real-time exposure ) that have worked very well over the last 15 years. The only one I use is a simple one with a very unique filter (not found in Ultra or anywhere else to my knowledge). But the UltraFS systems are as good as any of the trend-following strategies I'm aware of.
    • I pefer to consider how decisive the candle is when looking at the market sentiment at that exact moment. I think it's a more reliable source of information.
    • MetaTrader 5 Trade Forex, Contracts for Difference (CFDs), and binary options on MetaTrader 5 - a multi-asset platform that offers outstanding trading possibilities and technical analysis tools. Trade popular cryptocurrencies on our MT5 platform with leverage and variable spreads. 20$ No Deposit Bonus Still Available https://1binaryoptions.eu/review/binary-com
    • Very long time since I made last post. Thought about posting one chart. Stock name is masked intentionally as I am having position. My views may be biased. My way of viewing chart. Chart is self explanatory
    • Litecoin Price Prediction Today: Daily (LTC) Value Forecast – July 18   LTC/USD Medium-term Trend: Bearish ·         Resistance Levels: $100, $110, $120 ·         Support levels: $90, $80, $70 Yesterday, July 17, the price of Litecoin was in a bullish trend. On July 16, the downward correction ended at the price of $80 price level. The $80 support level was the previous low of April 11 and May 6. The support level is holding as the bulls made an upward move towards the EMAs. On the upside, if the bulls break above the 12-day EMA and the 26-day EMA, the crypto’s price will rise and retest the $140 overhead resistance level. However, the bulls are likely to face resistance at the $120 price level.The MACD line and the signal line are below the zero line which indicates a sell signal.     LTC/USD Short-term Trend: Bullish On the 1-hour chart, the LTC price is in a bullish trend. The 12-day EMA and the 26-day EMA are trending upward because the price has commenced an upward movement. On July 16, in the downtrend, the bears reached a low of $76 but pulled back above the $80 price level.   Yesterday, the bulls broke above the EMAs and commenced ranging below the $94 price level. Today the bulls have broken the $94 resistance level and  are approaching the high of $100.The MACD line and the signal line are above the zero line which indicates a buy signal.     The views and opinions expressed here do not reflect that of BitcoinExchangeGuide.com and do not constitute financial advice. Always do your own research.   Source: https://bitcoinexchangeguide.co
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.