Trade Graphs visualizer | Profit By Day (seasonality)?
Author: abegy
Creation Date: 3/21/2015 2:55 PM
profile picture

abegy

#1
Hi Eugene,

Is it possible to have a visualizer like Profit by Month but with days of the week ? When you are an intraday or swing trader, this view is more appreciate.
profile picture

Cone

#2
You can select Daily in the "By Period" Visualizer (valid for Portfolio Simulation mode sizing only).
profile picture

Eugene

#3
That's not exactly what Alexandre is looking for i.e. to find out if there's a tendency for particular day of week to be profitable or losing.

Enhancing the Profit By Month visualizer is an interesting idea, I'll mark to investigate into this matter.
profile picture

Cone

#4
Okay, but in the meantime it's pretty easy to copy the data to a spreadsheet and use a Pivot table to summarize the data by Day of Week.
profile picture

abegy

#5
Thanks Eugene. You have understood exactly what I would like.
It could be interesting if you can add also a filter to see the result by entry bar, by exit bar or like today without any filter.
profile picture

abegy

#6
Hi Eugene,

I have seen in another lab package, two features that wwe don't have in our visualizer :
- possibility to focus on a type of trade (short, long or both)
- possibility to see result for opening trade vs closing trade

In addition to this, the visualizer gives to the intraday trader the possibility to see the result by time of day.

You can see the screen shot of the visualizer here : https://www.qtlab.ch/images/StrategyLAB/Stagionalita%20OpenClose.PNG

Is it possible to add theses features ?

profile picture

Eugene

#7
Hi Alexandre,

QUOTE:
- possibility to see result for opening trade vs closing trade

If by "opening/closing trade" you mean "entry/exit signal" then the Contribution pie chart already lets you break the performance results down by entry / exit signal, calendar month etc.

QUOTE:
- possibility to focus on a type of trade (short, long or both)

Thank you for your suggestion. I think it's a good idea to add a new option "By position type" (Long/Short) to the Contribution tab. Look forward to it in v2019.07 of MS123 Visualizers (ETA end of June).

Since your post is found in a Trade Graphs thread I guess you wanted me to add this to said visualizer. Looked into it and unfortunately it doesn't appear feasible. As breakdown by position type was not a part of the initial requirements for Profit By Month/DayOfWeek, introducing it there would lead to reduced code quality and overload of its GUI with less useful options.

QUOTE:
In addition to this, the visualizer gives to the intraday trader the possibility to see the result by time of day.

Sorry, this is not considered.
profile picture

abegy

#8
Yes, when I said Opening / Closing trades, it was the same things as Entry/Exit date.

For me, the contribution and the Profit by Month (or Days of week) have not the same objective.

In one hand, the contribution must help you to detect if your trading result are almost equal at any configuration (or if you have a predominate result which gives you most of your performance and means your trading strategy is probably not so good). In others hand, the Profit By Month (or days of week) will help you to detect if there is a seasonality in your result (and help you to eliminate worst time frame periods).

And the problem is that the seasonality can be different if your are long or short and if you take into account the entry date or the exit date depending of the trade duration (of your trading strategy logic).


profile picture

Eugene

#9
Suggestion: break your strategy in two: long and short. After saving them as two distinct strategies you could analyze their seasonality separately. It is much easier for you to accomplish than considering a really involved change for the Profit By... tabs which I do not plan to do.
profile picture

abegy

#10
Ok. No problem. I understand. But what's about the Entry/Exit option ? This will really boost the possibility of study for the Profit By ... ?
profile picture

Eugene

#11
Still the same. Filtering the results by any Position property is not considered in these visualizers. Sorry.
profile picture

abegy

#12
Ok Eugene. But what's about the possibility to add two new bars (one with the result by entry date and another with the exit date) in the same bar graph ? You have no filter to add to the visualizer by this way. You have just to manage 3 series.

Sorry to insist on this feature :-).
profile picture

Eugene

#13
No problem Alexandre, I'll explain. The current logic happily operates on the Equity data series alone. It doesn't have to have any knowledge of required entry and exit dates which are Position object's properties. They would be extraneous to the otherwise robust and simple algorithm. The feature request would clearly add complexity to the logic, requiring a development, testing and support effort. And I'm not convinced at all that there might be considerable benefit. You know I appreciate (and implemented a lot of) your feature requests. Sorry to reject this one. :/
profile picture

abegy

#14
Ok. I understand better the issue your facing now. No problem.

Just for your information, there are several studies about the impact of the seasonnality (ex. : https://pdfs.semanticscholar.org/fe9b/755821ca3a53e1d16b1503772dba22ae4d9d.pdf or https://www.seasonalcharts.com/img/ZUTEXTEN/saisonalitaet_e.pdf).

It's that why if you can detect in your strategy some seasonality in your result depending on your entry/Exit date, it's a simple way to increase your result.
profile picture

Eugene

#15
Alexandre, I've got some questions for you:

1. Re: "possibility to see result for opening trade vs closing trade". Having revisited the other platform's screenshot I now think it plots the number of entries/exits made in an interval. (Negative numbers on the chart indicate that there were more exits than entries.) Something like this is already available in the By Period and Trade Graphs charts. If you were after something else then could you clarify? How would you calculate what you have on your mind given that trades can and will span over multiple periods and sometimes last for years?

2. Liked the Seasonality PDF, a good read. I think that to arrive at a chart like in the article it requires to note the prices (single symbol or for each symbol of a DataSet) at the beginning / end (or more likely the curve of day-to-day changes) of each period (say monthly) in a given data range (say 30 years) and average them. Not really a performance visualizer but potentially an interesting analysis tool. But do you see room for the actual entries/exits of a system here??

3. Last but not least. How would you calculate the "possibility to focus on a type of trade (short, long or both)"? Don't hesitate to give me more detail, it's still unclear to me. (We're not talking about the Trade Graphs visualizer here, rather evaluating something new.)
profile picture

abegy

#16
Hi Eugene,

My original problem was to detect if my trading strategy has some specific periods of time with losing most of the time. If yes, the idea was to bypass them with a filter (or delay my order). Because of that, as my strategy can have different entry logic if you are long or short, I have requested to see the visualizer with the result for Long/Short and both. Except the last point, the current visualizer reply to this subject. And as you said previously, the simple way to manage long and short view is to run my strategy just with long and after just with short trades.

But after reading several articles about market seasonality, I had another problem : If I know that a specific period is most of the time losing, this is a good idea to add a filter in my trading strategy to bypass it (or to delay my signal to enter in the next good period). Atthis time, I made a confusion with the original idea of the visualizer and request you to add a view by entry/Exit date.

So, now, I understand why you were sceptic. :-). Moreover, after a deep look in the screen shot, I think you have right. This is a view of the balance between opening and closing trades. I'm agree with you that we have similar visualizer in WL.

If you see the potential about the possibility to have a seasonality detection tool, the formula logic of the chart in the PDF document can be find here : https://www.seasonalcharts.com/FAQ.html#pos02. I agree with you that entries/exits of a system don't make sense here.

For your information, a more developed approach can be find in the same Italian lab software. See the screen shot here : https://www.qtlab.ch/images/StrategyLAB/StrategyLAB%201Seasonal1.PNG and https://www.qtlab.ch/images/StrategyLAB/StrategyLAB%201Seasonal2.PNG and https://www.qtlab.ch/images/StrategyLAB/StrategyLAB%201Bias%20DoW.PNG and https://www.qtlab.ch/images/StrategyLAB/seasonal%20and%20stdev.png. Is it something that you have in mind ?

On this case, I don't see any link with long and short trade.
profile picture

Eugene

#17
Thanks for the information, I put Seasonality visualizer on our backlog for later review (H2'19). btw: found other, different sources to seasonal charts so this kind of chart doesn't appear to be copyrighted.

P.S. Offtopic:
QUOTE:
And as you said previously, the simple way to manage long and short view is to run my strategy just with long and after just with short trades.

Just to add, the simplest way to do it is the Position Options PosSizer's option "Take (all | long | short) positions". It doesn't require you to change the Strategy code. Just a matter of making a choice in the dropdown box.

profile picture

abegy

#18
Thank you very much
profile picture

superticker

#19
QUOTE:
to detect if my trading strategy has some specific periods of time with losing most of the time.
I'm wondering if this can be handled best with some kind of PosSizer?

I'm having some problems separating "seasonal" from "market sentiment". I'm guessing "seasonal" means period performance changes specific to a particular stock; whereas, "market sentiment" means relative to a particular index. Please correct me if I'm wrong.

If you're interested in the former (changes relative to a particular stock), then you should be looking at ARIMA modeling. It's the "I" in ARIMA (i.e. the "Integrated" part) that you should focus on for the AutoRegressive Integrated Moving Average model.

I don't think Wealth-Lab performs ARIMA modeling in its current form. With its EMA indicators, it does perform the "MA" part of ARIMA, and the "AR" part can be performed by the FIR indicator (although WL isn't equipped to automatically solve for the FIR coefficients as we would do in ARIMA fitting). But there aren't any provisions to fit the Integrated part of ARIMA in WL that I'm aware of.

I would try googling "ARIMA" with "stock trading" to see what you find. If the "I" is what you're looking for regarding seasonal (and I'm not sure it is, but it might be), then you can try out some of the ARIMA fitting packages on R. WL and R can communicate via the R.NET interface.

---
One other note. I looked at some of the links in Post# 16, and the seasonal differences I see there are 0.2%. Are you saying this tiny difference is something to be concerned about? I'm thinking there would be more "noise" than signal in such a tiny difference, and I'm not sure how you could reliability discriminate the difference on a case-by-case (i.e. bar-by-bar) basis.
profile picture

abegy

#20
Hi Superticker,

For me, you cannot use an existing possizer to detect if there is a particular period in your trading strategy that you lose most of the time.
"
I'm not a specialist to give you a definition between "Market sentiment" and "Seasonnality". For me, seasonnality is like "Sell in "May and Go away". So, I think this is two différent things.

I would like to thank you to point me to have a look on ARMA methods. I didn't know it.

Concerning your last point, the "small value" can have a lot impact depending of your trading strategy horizon. If you have an intraday trader, this is important to know it. Of course, if you are an investor, this is not really important.
profile picture

superticker

#21
QUOTE:
have a look on ARMA methods.
ARMA is the AutoRegressive Moving Average without the seasonal factors. If you want to include seasonal factors, then you need to include the "Integrated" part as ARIMA does. Don't get the two confused.

But I would start learning about ARMA, then move into ARIMA when you are ready to add the seasonal factors to your model. As far as solution packages for R, I would pick an ARIMA package and just ignore the "I" part of the modeling step if you are not interested in seasonal factors. You can add those in later.

There are also "transitional" factors that can be used with transitional ARIMA modeling. It's these transitional (external) factors that are used to add leading indicators to the ARIMA model. Happy computing to you.
profile picture

Eugene

#22
Just a friendly note. Since ARIMA and co. isn't expected to occur in the "Trade Graphs visualizer | Profit By Day" visualizer (which is the topic), you might want to continue this discussion in a new thread.
profile picture

Eugene

#23
@abegy

Alexandre, now you can find a breakdown of profit (or loss - depending on system's overall profitability) on the Contribution tab as of MS123 Visualizers v2019.07.
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).