Bar of the Month
Author: by_maxxx
Creation Date: 1/19/2009 3:38 AM
profile picture

by_maxxx

#1
I'm trying to write a simple system that would buy at each N-th BAR (NOT "date") of each month. For.ex.: buy each 1st bar on the beginning of each month.
But I cannot figure out how to realize it in Wealth Script.
Could anyone help please?
profile picture

Eugene

#2
Hi there. By the way, which product are you using?

Here's how:
CODE:
Please log in to see this code.

profile picture

by_maxxx

#3
Hi Eugene!

Thanks for answering!
I'm using Wealth Lab Developer and still it's not clear for me what exact part of the above code should I put into CharScript Editor as it doesn't understand any of the above?

p.s: Just noticed,...i suppose i should have posted this question in Wealth-Lab 4 forum branch?
profile picture

Eugene

#4
QUOTE:
p.s: Just noticed,...i suppose i should have posted this question in Wealth-Lab 4 forum branch?

For sure.

Anyway, the pattern is pretty clear to code in WL4: detect the bar when month has changed, save it into an integer variable (e.g newMonth), then check if the current bar is equal to (that variable + offset).
profile picture

Cone

#5
Eugene's method is probably more efficient, but this is more straightforward for anyone asking this question -

CODE:
Please log in to see this code.
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).