Australian (ASX) Stock Market Forum

AmiBroker Tips and Tricks

Is it possible to modify the display of the weekly charts in Amibroker to show the "week" as the prior five trading days. So, on a Wed the last "week's" bar would be the prior 5 trading days (Wed, Thurs, Fri, Mon, Tue). The last week's bar would show the Wed open, H+L of the prior 5 trading days and the Tue close. All prior weekly bars would have to be adjusted as well.

A little out of the box, but interesting.

Edit: Does anyone know of charting software that can display any timeframe bars, like 3 days data showing as one bar and then for a larger timeframe 8 days data showing as one bar. Can TradingView do this?

Amibroker can very easily show any timeframe. There is a field beside the stock code that represents the timeframe. D is daily.
It's a dropdown list where you can choose a range of timeframes. But you can also just specify your own even if it's not in the list.
1605784113671.png1605784292864.png

Just type "3D" into the field and you get 3-day timeframe:
1605784174705.png

However, this isn't exactly what you asked for. When you set the timeframe to 3-day, Amibroker starts counting from the first bar on the chart and groups them accordingly. The example you asked for is a rolling 5-day chart, where the latest bar is made of the last 5 trading days. That means it would have to group them by counting backwards from the current bar. Every day you open the chart it will look different as the open day of the bars shifts every day. Interesting, but I don't know how to do it.
 
Thanks LW that's something that's interesting. On a Wed for example I could see a 5 day chart with the bars representing the last trading week. Yes, the chart would look different the next day. I was reading Cynthia Kase's book, "Trading with the Odds". As an engineer she has created indicators that represent the market in a different way than the traditional indicators. In the book she asks why should a trader who uses a weekly chart for trend or direction have to wait for Friday if there's a perfectly good daily buy setup earlier in the week.
 
Thanks LW that's something that's interesting. On a Wed for example I could see a 5 day chart with the bars representing the last trading week. Yes, the chart would look different the next day. I was reading Cynthia Kase's book, "Trading with the Odds". As an engineer she has created indicators that represent the market in a different way than the traditional indicators. In the book she asks why should a trader who uses a weekly chart for trend or direction have to wait for Friday if there's a perfectly good daily buy setup earlier in the week.

I might have to read the book. I’m trying to wrap my head around how a weekly bar that updates on a daily basis provides an advantage over using the daily timeframe? The advantage of using a weekly chart is that it adds a time delay which reduces noise. You might get a breakout of price on Tuesday which is an entry signal, but on a weekly system that bar has to close as a breakout on Friday to be valid. If you are trading on a rolling 5-day window, won’t you just get your buy signal on the Tuesday, same as a daily system? Maybe it just doesn’t make sense because I’m using something simple like a breakout in price.

It would allow you to use indicators designed for a weekly timeframe, but trigger entries on a daily timeframe. But with a chart where the bars change from day to day I imagine you’d have a problem with certain indicators repainting (unless you rewrote them to somehow account for it). Again, would it be better to use a daily timeframe with indicators set with a larger lookback to mimic their weekly equivalent?

Come to think of it, using a weekly timeframe is just a pretty lazy way of adding delay to daily data isn’t it? If you really wanted a time delay to reduce noise, you’d run a daily system and program in a delay (price must still be above the breakout level x days after the initial breakout). Weekly systems are inconsistent in that if the breakout happens on Monday, you need to wait until Friday for confirmation. But if the breakout happens on Friday, you have no delay on your signal at all.
 
Well reasoned. This is one of many examples where Cynthia Kase critically examines the traditional concepts in technical analysis. CK re-engineers the MACD because she wasn't happy with it. She re-engineers the stochastic to better align it with her way of thinking about the function of the indicator. In her later work she creates her namesake equal range price bars (Kase bars).
 
Well reasoned. This is one of many examples where Cynthia Kase critically examines the traditional concepts in technical analysis. CK re-engineers the MACD because she wasn't happy with it. She re-engineers the stochastic to better align it with her way of thinking about the function of the indicator. In her later work she creates her namesake equal range price bars (Kase bars).

Here is a link to the articles on her website. Some good reading in there.
http://www.kaseco.com/support/articles/ (When the front door is too onerous try the back door.......;))
This one on using std dev. for trailing stops is interesting.
http://www.kaseco.com/support/articles/Setting_Stop-Losses_Using_Price_Volatility.pdf
Pseudo code is in the paper and afl is available on line with a quick search.
 
Come to think of it, using a weekly timeframe is just a pretty lazy way of adding delay to daily data isn’t it? If you really wanted a time delay to reduce noise, you’d run a daily system and program in a delay (price must still be above the breakout level x days after the initial breakout). Weekly systems are inconsistent in that if the breakout happens on Monday, you need to wait until Friday for confirmation. But if the breakout happens on Friday, you have no delay on your signal at all.

Doesn't the same logic apply to EOD trading in light of intra-day movements. If the breakout happens on open you are delayed an entire day before you take the position the following day in your EOD, but if the breakout happens just before close then the delay is minimal before you take the position the following day in your EOD.
 
Doesn't the same logic apply to EOD trading in light of intra-day movements. If the breakout happens on open you are delayed an entire day before you take the position the following day in your EOD, but if the breakout happens just before close then the delay is minimal before you take the position the following day in your EOD.

Absolutely, the logic is the same. But in a practical sense - Weekly traders usually have access to daily data and the capacity to trade EOD. Far fewer EOD traders have intra-day data and the capacity to monitor and place intra-day trades.

If you felt I was looking down on weekly traders, my apologies, that's not what I meant. I only trade weekly.
 
If you felt I was looking down on weekly traders, my apologies, that's not what I meant. I only trade weekly.

Not at all....no apology necessary. I think you raise a very valid point. I live trade weekly and EOD systems and I agree with your point. ?

I just look at the numbers and my weekly has treated me very well.
 
Anyone know how to write a formula to obtain the Close on a specific date ?
i.e. what was the closing price of BHP on 5th April 2020?
 
@dutchie here is a start for you

1607465950638.png

1607465995361.png

Apply to current symbol and the above is returned

Code:
InputDate = "2020-04-05";
ClosePrice = Lookup( Close, _DT( InputDate ), -1 );

Filter =1;
AddColumn(ClosePrice,"ClosePrice");
 
@trav, the only question, I wonder if there is the possibility of a future leak with your solution?

In an exploration I can see the April Close in days (weeks, months, etc) before that date!

Whereas this possibility,
C_Cond = ValueWhen(datenum() == 1200406, Close); // April 6, 2020

only shows the Close on (and after) the chosen date.
 
@Tuco Ramirez good point, I didn't really spend much time on it but I re-read the help file and tested the following which appears to give the same result as your code (only returns the value when exact match is achieved)

ClosePrice = Lookup( Close, _DT( InputDate ), 0 );

So we could have to two possible solutions, and depending on what dutchie is trying to do, he/she can use either.
 
Run the amibroker code check and profile.

While not a truly definative answer, if you're not expecting future looking arrays and it finds one .... well he's screwed up.
 
An update on the "too good to be true" results. The weekly indicator array was looking 4 days into the future. After that fix and a few modifications the current results are;

Profit = 658826.80 (1704.16%), CAR = 79.72%, MaxSysDD = -92038.92 (-28.56%), CAR/MDD = 2.79, # winners = 5346 (42.32%), # losers = 7287 (57.68%)

Fairly typical results of a short term swing system. While the profit looks good it's very hard to trade with that size draw down. At least he's making some progress and learning about the process of back testing.
 
Was that over the 4 year period as before? I still think that CAR is pretty high. using leverage? A CAR of that size is pretty big IMO. May want to vary the dates in which hey are testing, different market conditions etc. And while I agree that a MDD of -28% is big and hard to deal with, I don't think its a deal breaker. I've only got to -25% which is roughly my hard limit on DD is. But if you had confidence on almost 80% CAR then -28% is nothing ...
 
I'd check the largest profitable trades. Sometimes a few crazy 2,000 or 3,000% gains canreally slew the results. And I agree a CAR/MDD of 2.82 is very good.
 
I'd check the largest profitable trades. Sometimes a few crazy 2,000 or 3,000% gains canreally slew the results. And I agree a CAR/MDD of 2.82 is very good.

That is a pretty good CAR/MDD, and that's a state I like to use. For me the issue is the size of the CAR. You may be right that its a few crazy big trades that are skewing it.
 
Top