How to find the best (most respected) anchored vwap at any given time.

 
I was brainstorming the other day wondering how one would go about coding something like this logically. I had an idea involving plotting a 1 period sma on the highest highs of each candle (for example's sake) then with a vwap on a higher timeframe create a variable which runs through each possible period from each lowest low or highest high as an anchor point. For each period, I would measure the amount of times this 1 sma is within a small envelope surrounding each vwap line. I would take the number of periods the sma was in this envelope, divide it by its current number of periods, and save it into a new variable if it is of higher correlation than the previous. Essentially what I should be left with is the VWAP line which was most respected in terms of correlation. From here I should be able to assign the desired anchor point and use this line as my point of interest until a VWAP with a greater correlation coefficient presents itself. 

I thought I should write this idea down somewhere before I forgot it and figured I might as well share it in case anyone more experienced has a better method of doing something like this. 

One problem I notice frequently with a great majority of eas is the static nature of lines used for points of interest. (Moving averages, vwaps, envelopes, etc) Only in the strategy tester do you find the best settings overall but rarely does one find a dynamic strategy which self-optimizes based on correlation. 

The greatest problem I see with this inherent flaw is the likelihood for settings to become overfitted, and quickly rendered useless in ever changing market conditions.
 
Your topic has been moved to the section: Technical Indicators
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 
  • Usually people who can't code don't receive free help on this forum.
  • If you show your attempts and describe your problem clearly, you will most probably receive an answer from the community. Use the CODE button (Alt-S) when inserting code.
  • To learn MQL programming, you can research the many available Articles on the subject, or examples in the Codebase, as well as reference the online Documentation.
  • If you do not want to learn to code, that is not a problem. You can either look at the Codebase if something free already exists, or in the Market for paid products (also sometimes free). However, recommendations or suggestions for Market products are not allowed on the forum, so you will have to do your own research.
  • Finally, you also have the option to hire a programmer in the Freelance section.
 
I think there were some creative "self optimising" vwap indicators on the marketplace (not free). Maybe you should take a look there, or are you sure the idea hasn't been put into action already?
 
Conor Mcnamara #:
I think there were some creative "self optimising" vwap indicators on the marketplace (not free). Maybe you should take a look there, or are you sure the idea hasn't been put into action already?
If there is, I haven't found anything. Marketplace indicators won't do me any good. I am looking to build this myself or pay to have it coded for me to save some time, because marketplace indicators don't come with source code. I don't know of any indicators which do this in this way. I had another idea, involving casting each period into a correlation matrix, although I think it might be a better idea to do that with use moving averages instead, and anchor them by truncating the infinite series of averaging periods at highs and lows. I came here hoping I could openly brainstorm with others and hopefully to learn alternative ways of doing this before I embark on the project. I will keep this updated as I progress, as things come to fruition, I may post developments, share code, etc.
 
Skyler James Lee:
I was brainstorming the other day wondering how one would go about coding something like this logically. I had an idea involving plotting a 1 period sma on the highest highs of each candle (for example's sake) then with a vwap on a higher timeframe create a variable which runs through each possible period from each lowest low or highest high as an anchor point. For each period, I would measure the amount of times this 1 sma is within a small envelope surrounding each vwap line. I would take the number of periods the sma was in this envelope, divide it by its current number of periods, and save it into a new variable if it is of higher correlation than the previous. Essentially what I should be left with is the VWAP line which was most respected in terms of correlation. From here I should be able to assign the desired anchor point and use this line as my point of interest until a VWAP with a greater correlation coefficient presents itself. 

I thought I should write this idea down somewhere before I forgot it and figured I might as well share it in case anyone more experienced has a better method of doing something like this. 

One problem I notice frequently with a great majority of eas is the static nature of lines used for points of interest. (Moving averages, vwaps, envelopes, etc) Only in the strategy tester do you find the best settings overall but rarely does one find a dynamic strategy which self-optimizes based on correlation. 

The greatest problem I see with this inherent flaw is the likelihood for settings to become overfitted, and quickly rendered useless in ever changing market conditions.

Won't the vwap diverge out of correlation anyway ? (because it becomes less sensitive as new bars come in.)

Also if it is intended for SR then you are not looking for correlation as the moment the price "hits" it it will diverge again

If you'd set some hard rules you could attempt at letting the machine do the work for you.

Some ideas :

  • The anchored vwap starts with a new high or a new low.
  • Previous anchored vwaps stop when a new one begins.
  • When the price breaks a vwap (without starting a new one) you create a signal.
  • The signal has properties like distance in bars from creation ,distance in price (of the vwap) from the pivot point that created it and type
  • Then you monitor the signal and it's outcome
  • You take all signals and store them 
  • You export the stored data to excel and let the Excel solver figure out if theres any edge there (i.e accept only between 2 distances in bars and price etc)