Enter or close a trade near close
Author: pestocat2
Creation Date: 4/16/2018 6:26 PM
profile picture

pestocat2

#1
I would like enter or close a trade near the end of the day or close. I assume I need to use the intraday candles, I'm thinking 30 minute ones. For the indicator settings I assume I will need to multiply the daily ones by 13 is that correct.
profile picture

Eugene

#2
A wise man's question contains half the answer, they say. Naming a topic like "Intraday Trading" is suboptimal and too generalized. Let's make it "Enter or close a trade near close" then. If a topic is named in a more descriptive manner it would pay for itself as a search reveals solutions instantly. For example, if you searched for "close" you'd find this informative thread:

Exit before market close

As an alternative, you can accomplish this on Daily bars with a trick described in the WealthScript Programming Guide > Programming Trading Strategies > Alerts > How to: Alert for AtClose Signals.
profile picture

pestocat2

#3
I have looked at "How to: Alert for AtClose Signals" many times and I have not yet understood "bar +1" it would seem that we are buying at the next day opening. What am I missing.
profile picture

Eugene

#4
You asked for "enter or close", so this was the exit technique. (A more complicated example can be found in Techniques > Exit Intraday AtClose.)

In general, doing what you said about the indicator settings is incorrect. In Wealth-Lab you can compress intraday data to daily scale as described in the WS Programming Guide > Multi-Time Frame Analysis > Intraday/Daily.
profile picture

pestocat2

#5
I want to use daily bars for the indicators with 30 minute intraday bars. Then make the buy/sell 30 minutes before close. I've read and re-read the programming Guide for Intraday trading but don't see a method. The crossover speed should be at the daily rate and not the intraday rate.
profile picture

Eugene

#6
profile picture

pestocat2

#7
I'm just not getting the concept of using "SetScaleCompressed() or RestoreScale(). What changes do I make to my original indicator settings. I'm having trouble getting this.
profile picture

Eugene

#8
SetScaleDaily in your case, not SetScaleCompressed. The changes to be done depend on your Strategy code. You'll find them documented in the WS Programming Guide and thoroughly exemplified in various forum posts, QuickRef (F11 key in Wealth-Lab), downloadable Strategies (Ctrl-O in WL), and the Wealth-Lab Wiki.
profile picture

pestocat2

#9
I'm using the HullMA intraday with 30 minute candles. In order to achieve what looks like a 20 day HullMA but in 30 minute candles I set the period setting to 260 instead of 20 (20 * 13). This looks and behaves very well. I dragged a CMF (21) and MACD (12,26) to the chart and these also seem correct. Should I have also multiplied the setting by a factor of 13. See attached.
profile picture

Eugene

#10
It's up to you to hold on to your belief. You're not going to hear anything else from me than that the correct way to go is outlined in posts #4 and #8. Good luck.
profile picture

pestocat2

#11
Eugene,
I had already used the SetScaleDaily; My goal is to have the indicator values for any specific date to be the same whether at 'Daily' or '30 Minute' setting. My chart looks good now maybe I hadn't set the data start date back far enough.
Gary
profile picture

Eugene

#12
Gary,

If you look at an intraday chart with a DataSeries to which SetScaleDaily is applied, you'd see that Daily indicators are calculated once a day at close. They will not have their readings equal to 30-minute chart throughout the day.

Neither there's a silver bullet for matching the EOD and intraday indicator values by picking out a multiplier. There always will be something like a short market session on one hand or an indicator with a non-period parameter that cannot be scaled on the other hand.

You could probably get closer by manually recoding all your indicators as per this link (Updating a Daily indicator using Intraday values) but this is off topic here.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).