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.


×
×
  • Create New...

Important Information

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