NexusFi: Find Your Edge


Home Menu

 





Outside the Box and then some....


Discussion in Trading Journals

Updated
      Top Posters
    1. looks_one iantg with 66 posts (325 thanks)
    2. looks_two artemiso with 12 posts (34 thanks)
    3. looks_3 SMCJB with 12 posts (15 thanks)
    4. looks_4 pen15 with 10 posts (2 thanks)
      Best Posters
    1. looks_one iantg with 4.9 thanks per post
    2. looks_two wldman with 3.7 thanks per post
    3. looks_3 artemiso with 2.8 thanks per post
    4. looks_4 SMCJB with 1.3 thanks per post
    1. trending_up 31,797 views
    2. thumb_up 410 thanks given
    3. group 64 followers
    1. forum 137 posts
    2. attach_file 52 attachments




 
Search this Thread

Outside the Box and then some....

  #71 (permalink)
pen15
Choctaw
 
Posts: 10 since Sep 2017
Thanks Given: 12
Thanks Received: 2

Ian, Thanks for this thread! I've gained a lot of insight from your candidness.

I took your idea on "metadata" and I've started printing "volatility" (based on your 10 bar example), VROC and other other metrics to my output tab. I just got the coding done and haven't thought much about how I'll go about optimizing. I ran a backtest with a simple EMA strategy over a year for some data to test. Right now I'm manually filtering columns in excel (volatility > n for example) just poking around seeing how it affects the overall P/L. So here's my question: What is your method to optimize a strategy once you have this metadata?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
What broker to use for trading palladium futures
Commodities
Trade idea based off three indicators.
Traders Hideout
 
  #72 (permalink)
 iantg 
charlotte nc
 
Experience: Advanced
Platform: My Own System
Broker: Optimus
Trading: Emini (ES, YM, NQ, ect.)
Posts: 408 since Jan 2015
Thanks Given: 90
Thanks Received: 1,148


pen15 View Post
Ian, Thanks for this thread! I've gained a lot of insight from your candidness.

I took your idea on "metadata" and I've started printing "volatility" (based on your 10 bar example), VROC and other other metrics to my output tab. I just got the coding done and haven't thought much about how I'll go about optimizing. I ran a backtest with a simple EMA strategy over a year for some data to test. Right now I'm manually filtering columns in excel (volatility > n for example) just poking around seeing how it affects the overall P/L. So here's my question: What is your method to optimize a strategy once you have this metadata?


Hi Pen15,

Thanks for reading this thread and thanks for asking. This is a great question. I have a pretty thorough process to my optimizations and I will likely post on this in more detail in the near future, but generally what you are trying to do with any type of optimization once you have metadata is isolate your variables to try to see if there is any sort of correlation that drives performance up or down. I will give you an idea pertaining to volatility to try. Test this and see what you think, but it should work for you. Using your metadata (Output print windows) you need to collect the following variables:

1. Trade Number
2. Volatility level: (There are a ton of ways to quantify this, and I provided some examples in prior posts, and there may even be some indicators for this, but really what you are trying to do is just get the numbers. 1-10, 3-7, (Low, - High) how ever you draw the line in the sand.
3. Profit Target (In terms of number of ticks
4. Stop loss in terms of number of ticks

Technically you don't have to even collect the last two you just have to keep these constant for the test. So don't change these at all, pick a setting, say for example a PT of 5 vs. an SL of 10, and don't touch it for the entire simulation.

Now for the testing: You will need to run at least 3 simulations over a period of time. If you can do this via a strategy then this will be ideal as you can collect more data much faster but if you are doing it discretionary then at least get a day per sample. But here is the general idea for the tests.

Test 1: Set a Tight PT with a High SL. Let's say 3 ticks of profit and 6 ticks of loss, or some other 1x2 ratio that seems appropriate for the instrument you are testing. Then run the simulation collect all your statistics and correlate the following.

A: For each trade # what was the volatility number: 1-10 for example
B: For each trade # what was the outcome. Did you win or lose?
C: We already know the PT and SL settings because these were constant through out the whole simulation.

Now here is the analysis, take your results in a spreadsheet format and put these into a pivot table and then aggregate the results by the volatility levels 1-10 and you will see the following:
1. At low levels of volatility 1-3 for example, was your net profit (All trades combined with volatility at this level) positive or negative, what was your average trade value for example.
2. At medium levels of volatility (4-6) for example what was your average trade value, and total net profit
3. At high levels of volatility (7-10 for example) what was your average trade value and total net profit

You will quickly find that setting a low PT against a high SL is very favorable in a low volatility type of trading environment, but typically performs poorly in a high volatility trading environment. In low volatility the market stays in a tight range, so by placing your stop loss just outside of this range, you will almost never hit it, so even though it may have 2x or 3x the value of your PT, you can beat the expectancy.

Next simulation: set your PT at 1.5 x or even 2x your SL. Lets say PT = 8 and SL = 5 (just throwing it out there).
Now run the exact same test and collect the statistics the same way. Here you will see the following.

In low volatility you hit your SL way more than your PT and lose.... Big time. But in times of high volatility, the odds of a big move occurring are equally as likely as a small move, so your # of winners may be close to even your number of losers but the value of your winner is 1.5 or 2X the value of your loser. You will crush it with this populations.

And you will run the same type of test for medium volatility levels, etc, and find the sweet spot there too.

I can't tell you how easy this is conceptually, but it takes time and is quite boring to do, and finding exactly where the lines are can be tedious and will take lots of repetition, but eventually these will be crystal clear and you will start crushing it more than you can ever believe.

The volatility measurement itself takes some work to optimize because you can use a 5 period, 10 period, 20 period or greater population to sample the data to find the absolute delta between the high and low, but depending on your time series this may be to tight or too lose. For example running a 5 period measurement on tick data of like 15 ticks would produce next to nothing, everything would show as low volatility because you are too zoomed in. By contrast if you back this up to a 50 period measurement over a 30 minute time period the volatility looks crazy high all the time. You need to find that sweet spot where you can see good delineation. So this is your first step.

Your second step is finding the right PT / SL settings to get good throughput in low volatility and high volatility within your chosen time frame. This will take a lot of tweaking.

Finally your third step, is to find the exact lines. It's easy to see low and high volatility but medium is way more subtle and there may be 2 or 3 levels of delineation here you may want to add within this population. Ultimately by testing over and over in different time frames, with different volatility settings and different lines in this sand here is what you are hoping to come up with.

1. For low volatility quantified by values of X or less, trade with a PT of Y against an SL of X. I told you generically what this is, but you will need to find the sweet spot with your given instrument.
2. For high volatility quantified by values of X or >, trade with a PT of Y against an SL of X. Here you want to shoot for home runs and eat more losers than winners but with lower value losers and higher value winners. Something in the 2x1 range or >.
3. Medium volatility: This is the trickiest part, because you will need to find the exact volatility level matched with the exact PT / SL setting to switch between low and medium and medium and high. Within medium you may want to bifurcate this further into medium low / medium high, etc. But generally you are trying to keep your PT / SL fairly even, so that as these play out you have 50%/ 50% winner / losers and the payout is equal. Truthfully there is a lot less of a chance to exploit these type of market conditions. The best play here is to set the bet line even and just wait for a change back to low V or high V where you have a definitive betting edge.

Anyway, I can cover more about the metadata and process you will need but this should help you get setup and started. Good luck. I hope you crush it!

Ian

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #73 (permalink)
pen15
Choctaw
 
Posts: 10 since Sep 2017
Thanks Given: 12
Thanks Received: 2


That’s super helpful to know how you change stops and targets in different volatility environments. I like the idea of pivot tables to optimize, but I think there could be a more automated and complete way to find the very best combination. I’m trying to use excel’s solver add-in to run through various iterations of the volatility level to maximize profit over my 1-year data set. Still working out some bugs though. I think I’ll also try to make volatility a strategy input so I can test it with ninjatrader’s optimizer, though I’m not sure how accurate the optimizer results are.

Reply With Quote
  #74 (permalink)
 iantg 
charlotte nc
 
Experience: Advanced
Platform: My Own System
Broker: Optimus
Trading: Emini (ES, YM, NQ, ect.)
Posts: 408 since Jan 2015
Thanks Given: 90
Thanks Received: 1,148

One of the more powerful but less understood optimization tools out there is the MAE / MFE stat. For the uninitiated:

MAE: Maximum Adverse excursion: This shows you the most ticks you were upside down in a given trade. (Your worst position) Sometimes this is = to your stop loss, sometimes it is worse than your stop loss, and other times (For winning trades) it shows the closest towards your stop loss that you got.

MFE: Maximum Favorable excursion: This shows you the most ticks you gained positive in a given trade. (The highest value positive you ever hit). This may be = to your PT, or even higher if you don't have a hard PT for example. For losing trades this shows you how close you got to hitting your PT before your trade turned into a loser.

There are a number of trading platforms that collect this data for you automatically. NinjaTrader has this statistic built into backtesting / simulations and market replay. So getting the data is quite easy, but analyzing it and turning this into actionable insights can be a bit tricky. It took me over a year of backtesting before I even looked at it and understood what it was and starting figuring out how to use it to my advantage. So I am going to throw out a few ways it helped me, in the hopes that others may learn from this.

You will be running a few test simulations to try to optimize your exits using the results of the MAE / MFE to fine tune your exit system.

For each of these tests you will use the exact same entry system. So whatever alpha signal you use for your entries (If this occurs go long, if that occurs go short) do not change this throughout the course of your tests.

Test 1: Set a fairly high profit target against a fairly low stop loss. Something in the 2x1 range. Run your simulation on a decent population of data. Do at least 1,000 trades (Ideally over different time frames with different seasonality, volatility, etc). Then analyze your results by running the following what if scenarios:

MFE Analysis 1. If the profit target was shorter by 1 tick, 2 tics, 3 ticks, etc, how many more winners would I have had? You can find this out by looking at all your losers and seeing the MFE: For each of these, how close were they to your profit target? Your goal in this "what if analysis" is to try to turn as many of your losers into winners as possible. But in order to do this and keep the results honest you will also have to decrease all of your winners by the same number of ticks. So for example if your original profit target was 10 ticks and your original stop loss was 5 ticks, and you only won 20% of the time, but if after analyzing your MFE you fine that at 8 ticks you would have won 35% of the time, you have to take all of your winners at 10 ticks and make them 8 ticks as well. This gets you more winners, but you lose a couple of ticks on your existing winners. Now the comparison... Does this "what if scenario" perform better or worse for you? You will have to do this type of "what if analysis" on every single tick level from the current PT down all the way to 1 tick to see every possible outcome, but ultimately you will find that by reducing the PT down, you increase your winning percentage and at a certain threshold you will find the sweet spot that optimizes your profit.

Test 2 analyzing the MAE: Now for test 2 you will need to run the test slightly backward. Set your stop loss higher and your PT lower. Maybe run it with the opposite 1X2 PT = 5, SL = 10. After 1,000 trades or so, you will be analyzing your stop losses and running a series of "what if analysis" on them. Using the MAE on your winning trades, if you move the stop loss up from 10 ticks, to 8 ticks, or 5 ticks and essentially turning winning trades into losing trades will this help your overall performance. You may at first think this is a crazy idea, why would you want more losing trades? But the obvious benefit is that you can decrease all your actual real trades at 10 ticks down to this new level. So lets say that if instead of running your stop loss at 10 ticks, you move it up to 8 ticks. If your MAE only shows that 5%-10% of your winners hit this level, then you eat 5%- 10% more losses but all of your 10 tick losers now get to hurt less and become 8 tick losers. So with this approach in mind, you will need to run this sort of "what if analysis" on ever tick level from 10 down to 1 to see where that sweet spot is at.

Naturally this process can be quite tedious and take a lot of work to find the sweet spot on each side, and what comes next is a bit like whack a mole, but you get to take the optimized result of each side and then rerun the test again! The full series that I recommend follows this pattern:

Level 1:
Series 1: High PT / Low SL (Target Optimize the PT)
Series 2: High SL / Low PT (Target Optimize the SL)

Level 2: (Using the results of series 1 as the input)
Series 1a : Series 1 optimized PT vs High SL
Series 1b: Series 2 optimized PT vs Low SL

Level 3: (Using the results of series 2 as the input)
Series 2a: Series 2 optimized SL vs High PT
Series 2b: Series 2 optimized SL vs Low PT

In series 2 and 3 your goal should be to optimize the opposite side testing both high and low to find opportunities.

Finally once you have a full analysis from series 2 and 3, you run the final optimized outputs together in the last simulation. Eventually you will find the best combination.

This process in case you are thinking it already.... is known as curve fitting. And if done on a small sample size this serves little to no purpose other than showing that you can find the answer to beat a specific sample of data by optimizing your strategy. But if you do the work (And it is a ton of work) over a very large population, say for example 3 years and hundreds of thousands of trades, then your results will be not curve fitting for a small population but for the actual instrument you are trading. Obviously most people have a life outside of trading, and if your entry system is only mediocre this type of analysis and time spend may not be enough to save you, but if you already have a decent system, this may be a nice approach to give you even more edge.

Happy Trading!

Ian

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #75 (permalink)
 iantg 
charlotte nc
 
Experience: Advanced
Platform: My Own System
Broker: Optimus
Trading: Emini (ES, YM, NQ, ect.)
Posts: 408 since Jan 2015
Thanks Given: 90
Thanks Received: 1,148

I recently punted out a topic a few posts ago concerning the nano-structures the ES market and the way the levels were being cleared by alternating between the bid and ask volumes. I got some good feedback and there were some gaps in the data I was seeing and what theories we all came up with to describe the behavior of the market. Based on the ideas of @Popsicle and @SMCJB (That the queue for market orders would match with the queue for limit orders and work in tandem based on FIFO) I knew that I had some gaps in my data but I couldn't quite get my head wrapped around how to see the market any more granular.

So I took my granularity level from 50 ticks down to 1 tick and tried to see if I could build a full sequence of trades from x contracts down to the last 1 contract before each level broke. After doing some research I have come to understand that this will never be achievable based on just the GetCurrentBidVolume() / GetCurrentAskVolume() alone. There are always going to be gaps in the data between each update as new contracts get added to the queue and transactions occur.

So I have been working on a few ideas to try obtain as much granularity as possible and I have come up with something pretty neat that I wanted to share. Using the https://ninjatrader.com/support/helpGuides/nt8/en-us/?marketdataeventargs.htm methods I have been able to build a full history of all transacted volumes at the bid and ask between each update from GetCurrentBidVolume() and GetCurrentAskVolume(). I still have no way to quantify new volumes added to the queue and canceled orders, but I can at least gain visibility to transacted volumes between updates. So this should at least improve my visibility to the worst possible scenarios such as.

1. Between updates: There is a massive series of large transactions on one side, moving the volumes down to near 0.
2. Between update: One side shifts and the volume power switches significantly to the other side between updates.

In addition to this, I have implemented a queue position tracker to quantify where I am at in the queue. This works like this.

1. When an order gets placed, grab the applicable volume (bid or ask) and use this as a starting point. This is the number of contracts that have to clear before you will get filled.
2. Keep a running tally of all the transacted volume that occurs after your entry. Once this running total exceeds the original volume of your entry you can safely assume a fill. In practice this will likely occur even faster due to orders that cancel. Unless you are not measuring FIFO instruments this approach will work.

So I built this queue tracker in connection with live updates to the running bid / ask volumes between gaps to try to give me insight into the following.

1. How close am I to getting filled relative to the level breaking against me? For example if there are 20 contracts ahead of me that need to fill before I get filled, but only 30 contracts left total, then waiting in line to get filled would be bad. Because as soon as I get filled, the price level will change and I will be down 1 tick.

2. Is there a specific ratio of bid / ask volumes present when entering a trade that will make it more likely or less likely to get filled in the following ways.
A: You get filled safely on a level, but neither close to the level breaking in your favor or against you.
B: You get filled because you are in the front of the queue and the opposite side is week, so therefore it will likely break and you will move up 1 level with an instant positive position of 1 tick.
C: You are in the back of the queue and your fill will come at the expense of the level immediate dropping against you and you will be down by 1 tick.

So I am in the process of building some models to test this over millions of simulations of different entry points with different starting conditions. I am assuming entry attempts take place on every price level and I am running this on 1 tick data. So for context a few hours ends up being > 100K rows with very rich data points. I haven't quite started working on aggregating this up to less granular time frames but I imagine it can be done fairly easily. For now I am just trying to find some sweet spots.

I am enclosing a small sample of this data output just to see if anyone wants to take a whack at analyzing it and throwing in their two cents on some possible good / bad entry points. For this sample data I assumed the entry points in all cases would be the weak side entry on a price level change. So for example: If the price moved up a level, the entry point would be to buy the bid, by contrast if the price moved down a new level the entry point would be to sell the ask. This was just easy to program to start off with. Eventually I will find ratio specific entry points based on volumes and resting on various levels away from the entry level, but this is just a starting point.

If anyone wants to take a whack at analyzing this and giving me some ideas, I am game.

Thanks,

Ian

Attached Files
Elite Membership required to download: NanoStructure + Queue Positioning Research.xlsx
Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #76 (permalink)
 
wldman's Avatar
 wldman 
Chicago Illinois USA
Legendary Market Wizard
 
Experience: Advanced
Broker: IB, ToS
Trading: /ES, US Equities/Options
Frequency: Several times daily
Duration: Hours
Posts: 3,534 since Aug 2011
Thanks Given: 2,069
Thanks Received: 9,556

I appreciate this post and I respect the work, for sure. So not to discourage, but rather to understand your focus...What will completion of this project mean for making money? How will you monetize this effort?

Dan

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #77 (permalink)
 iantg 
charlotte nc
 
Experience: Advanced
Platform: My Own System
Broker: Optimus
Trading: Emini (ES, YM, NQ, ect.)
Posts: 408 since Jan 2015
Thanks Given: 90
Thanks Received: 1,148


wldman View Post
I appreciate this post and I respect the work, for sure. So not to discourage, but rather to understand your focus...What will completion of this project mean for making money? How will you monetize this effort?

Dan

Hi wldman, Thanks for inquiring. I suppose some of my ideas can sound a bit like rambling nonsense at times... So I imagine there are still plenty of dots I need to connect to correlate how such an undertaking can assist with improving my trading.

Basically I am working on this type of research to help me improve my entries. Like so many others I suffer from entering on the wrong side at times, or put another way my timing might be off so getting filled comes at the expense of immediately being down 1 tick. This may sound insignificant, and for traders that hold longer positions this wouldn't amount to too much, but I am in the HF trading spectrum so losing a tick at entry really costs me.

To your question about how it will translate into making money: If I can tighten up my entries by filtering out trades that are going against me (I.E my place in the queue is too close to the end of the line and the level is close to breaking) then I would have far more profitable entries.

There are 3 distinct types of entries that can be observed from this research.

1. Your position in the queue relative to your side's volume is stable, but the opposite side is also stable. This implies you will likely get filled in the middle of the current price level but you are not sure whether the level will break up or down.

2. Your position in the queue relative to your sides volume is very favorable, and the opposite sides volume is fairly week. For example you are position 10 in the queue for bids and there are a total of 200 bids, on the opposite side there are only 50 asks. So the most likely outcome here will be to fill your order prior to the 50 asks getting filled, then shortly after you get your fill, the 50 asks clear and you immediately see the price level move up and you are up by 1 tick.

3. Your position in the queue relative to your sides volume is very poor, and the opposite side is very strong. For example you are # 20 in line and there are only 30 contracts on your side, by contrast there are 300 contracts on the opposite side. In this case you will get your fill, and immediately the level will break and you will be upside down 1 tick.


So the goal of my research at a minimum is to identify type 3 above and cancel my order before the shoe drops. This would end up producing more type 1 and type 2 scenarios. Without this I am flying blind.

In type 2 scenarios I would immediately be profitable, and in type 1 I would at least not immediately suffer a level change against me. I would likely ride this one out and cancel if it starts too look bad, or let it fill me if it looks good.

If I can get around 70% type 1 and type 2 entries and only 30% type 3 entries then this would be a considerable success. Hope it makes sense. If you would like to know any other specifics let me know and I will be glad to share!

Ian

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #78 (permalink)
 
wldman's Avatar
 wldman 
Chicago Illinois USA
Legendary Market Wizard
 
Experience: Advanced
Broker: IB, ToS
Trading: /ES, US Equities/Options
Frequency: Several times daily
Duration: Hours
Posts: 3,534 since Aug 2011
Thanks Given: 2,069
Thanks Received: 9,556

That makes a lot of sense. There are a few guys on here, one notable being @artemiso , that might chime in. I just have one friend, a floor holdover that is active in that space. He know nothing about the mechanics of how their systems work. He simply manages a position that the computer gives him.

If the names Getco or Steve Schuler are familiar to you he is a local neighbor. When the time is right I might have enough rapport to make an introduction if you promise to focus on his advise for your plan.

Dan

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #79 (permalink)
 iantg 
charlotte nc
 
Experience: Advanced
Platform: My Own System
Broker: Optimus
Trading: Emini (ES, YM, NQ, ect.)
Posts: 408 since Jan 2015
Thanks Given: 90
Thanks Received: 1,148

Dan,

Wow! Thanks for reaching out, and of course I would welcome any introduction from anyone that has expertise in this space.

Thanks,

Ian


wldman View Post
That makes a lot of sense. There are a few guys on here, one notable being @artemiso , that might chime in. I just have one friend, a floor holdover that is active in that space. He know nothing about the mechanics of how their systems work. He simply manages a position that the computer gives him.

If the names Getco or Steve Schuler are familiar to you he is a local neighbor. When the time is right I might have enough rapport to make an introduction if you promise to focus on his advise for your plan.

Dan


Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #80 (permalink)
 
SMCJB's Avatar
 SMCJB 
Houston TX
Legendary Market Wizard
 
Experience: Advanced
Platform: TT and Stellar
Broker: Advantage Futures
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals and Crypto.
Frequency: Many times daily
Duration: Never
Posts: 5,049 since Dec 2013
Thanks Given: 4,388
Thanks Received: 10,207



wldman View Post
There are a few guys on here, one notable being @artemiso , that might chime in.

I agree this is definitely his area, but he's not using NT! He has posted a lot in the High Frequency Thread and has his own Ask Me Anything Thread, but his participation here is irregular.

Reply With Quote
Thanked by:




Last Updated on June 23, 2018


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts