Trading live from 1 minute bars
Author: topcat77
Creation Date: 8/13/2008 4:10 PM
profile picture


I use a WealthLab program to identify one signature pattern that can either generate a buy or short signal. Currently my eod routine will give me a ton of signals which I manually screen through four filters. First question: can I write 'if' statement into my script eg if the signal comes from only the last two bars then disqualify it. So far I've done some 340 trades (round trips) during the first three months of testing.I now want to bring it to additionally trade 1 minute bars. Is this possible?
profile picture


First question: sure, but if you disqualify the signal from the last 2 bars, you're not going to get any Alerts. (I must have misunderstood you.)

Second question: Anything's possible.
profile picture



Ok, I've set up the program to get alerts on 1 minute bars and got a couple of trades off today (DIG at 79.42 for example).

To summarise the program, if current-bar has a new low during the designated time period, is at or lower than the lower Bollinger, but has a higher Rsi than previous low-bar (the comparison bar) then there is a signal. Reverse it all for highs to produce a short signal.

Now the filters:

1 Cone, you're right : what I meant to define was that IF the signal derives from current-bar and the comparison bar is the one bar before then the signal does not count. So, more accurately, the filter needs to disqualify the one bar before current-bar

2 IF the volume for current-bar exceeds the volume for the comparison bar
then the signal does not count

3 IF the sum of(price difference as a percentage) and difference in Rsi is less than 5, then the signal does not count

Could you point me in the right direction to write these IF statements

I want to get ready to auto-stage orders, long and short, when the new release gets here

profile picture


1 - I understand what you're saying (the words), but the concept doesn't make sense to me if you really want to trade. I need a concrete example.

2 -
Please log in to see this code.

3 -
sum of(price difference as a percentage) and difference in Rsi is less than 5

You'll have to explain this one more clearly too or provide a concrete example.
The price difference of what?
"sum of () and difference in Rsi" :?
profile picture



A thought : it seems to me that a better way to effect the first filter would be to say that, when finding the previous low, ignore the one bar before current-bar. This also more closely achieves the logic of the system
profile picture



Numerical Example for Filter 3:


CURRENT-BAR 92.62 70.07
COMPARISON-BAR 92.73 66.32

VALUES) 0.11 3.75

= 0.12% + 3.75 = 3.87 NO SIGNAL (<5)


CURRENT-BAR 128.05 40.91
COMPARISON-BAR 129.75 36.0

DIFFERENCE 1.70 4.91

= 1.33% + 4.91 = 6.24 GOOD SIGNAL (>5)

profile picture


profile picture


I still don't know what you mean by saying, "the filter needs to disqualify the one bar before current-bar", but, adding and subtracting are a pretty simple operations in Wealth-Lab. Please work with the examples in the WealthScript Programming Guide. Really it's as easy as Close[bar] - someOtherDataSeries[bar] ..

My advice for Excel (if you really must use it) is to export the data to comma-delimited text and then you can easily open it in Excel. See "Exporting Data..." in the Wiki Knowledge Base for an example.
profile picture


To find the Lowest Bar during the designated period but not including the penultimate bar I looked through the Wiki pages closely but could not find anything so I simply went:

int prevLowBar = (int)lowBar[bar-2]

This fits the logic of the divergence model I use and seems to work. Can this cause unintended results?

2) Rsi divergence: In identifying Rsi divergence I want to include the concept of the need for a material difference between the two Rsi readings that belong to the current bar and the previousLowest Bar; for instance, I want to say that a divergence takes place only if this bar is lower than the previousLowest Bar and the Rsi for this bar is higher than the Rsi for the earlier bar by say, 3.75. How can I accomplish this? I've looked through Wiki pretty thoroughly but (to my untrained eye) i couldn't find a solution

My current script reads:

int rsiSign = Math.Sign(rsi[bar] - rsi[prevLowBar])

then if the signs are different it generates a signal

can I insert the 3.75 in this equation ?
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).