NexusFi: Find Your Edge


Home Menu

 





Combining discretionary trading, risk management and ML as an art


Discussion in Emini and Emicro Index

Updated
      Top Posters
    1. looks_one aquarian1 with 40 posts (39 thanks)
    2. looks_two Big Mike with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 TheTradeSlinger with 1 posts (1 thanks)
    1. trending_up 8,455 views
    2. thumb_up 40 thanks given
    3. group 14 followers
    1. forum 41 posts
    2. attach_file 18 attachments




 
Search this Thread

Combining discretionary trading, risk management and ML as an art

  #21 (permalink)
 
aquarian1's Avatar
 aquarian1 
Point Roberts, WA, USA
 
Experience: Advanced
Platform: IB and free NT
Broker: IB
Trading: ES
Posts: 4,034 since Dec 2010
Thanks Given: 1,509
Thanks Received: 2,593

At this point in the thread I think I need to add a real world example.

The course has been good so far - but now has it's own 'concept drift' with very brief videos by the new lecturers.

In the lesson where they did time series analysis (apple stock), I sensed how the instructors knew machine learning and stats but did not connect to real world and specifically trading. And that of course is the key to this thread - moving from the abstract to the real world.

(As a small digression I remember thinking how educators could do a ral service by interviewing people who are working in their own fields and ask them what are both the good and bad of their professions - what the reality is.)

So I have created an ARFF file (the Weka format) with CL daily OHLC & vol. Weka has readers to pull in CSV formats and Excel formats (among others such as db). However, the CSV convertor gave errors and the Excel showed my date as numeric (so the format one sees for a date 25-Oct-2107 or 10/25/2017 etc is not how the spreadsheet stores it 43034=numeric not date).

So it was quite a bother to find a work-a-around to create a file with the date as a date and not numeric.

..........
peace, love and joy to you
.........
Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
ZombieSqueeze
Platforms and Indicators
REcommedations for programming help
Sierra Chart
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Tao te Trade: way of the WLD
24 thanks
My NQ Trading Journal
14 thanks
HumbleTraders next chapter
11 thanks
GFIs1 1 DAX trade per day journal
11 thanks
  #22 (permalink)
 
aquarian1's Avatar
 aquarian1 
Point Roberts, WA, USA
 
Experience: Advanced
Platform: IB and free NT
Broker: IB
Trading: ES
Posts: 4,034 since Dec 2010
Thanks Given: 1,509
Thanks Received: 2,593

As I was starting to learn about ML I listened to a series of fast paced youtubes.

I thought I would include then if they are of interest to others.


intro to deep learning


Intro in Deep learning 2


Sentiment Analysis 3

waldeinsamkeit - alone in the woods connecting to nature

Math used in neural nets 4


Predicting Stock Prices - Learn Python for Data Science Siraj Raval


How to Make an Image Classifier - Intro to Deep Learning #6


This isn't on ML but interesting
HOw to learn


[yt]https://www.youtube.com/channel/UCWN3xxRkmTPmbKwht9FuE5A/videos[/yt]

..........
peace, love and joy to you
.........
Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #23 (permalink)
 
aquarian1's Avatar
 aquarian1 
Point Roberts, WA, USA
 
Experience: Advanced
Platform: IB and free NT
Broker: IB
Trading: ES
Posts: 4,034 since Dec 2010
Thanks Given: 1,509
Thanks Received: 2,593


I have added info about ML into the summary page

logit

..........
peace, love and joy to you
.........
Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #24 (permalink)
 
aquarian1's Avatar
 aquarian1 
Point Roberts, WA, USA
 
Experience: Advanced
Platform: IB and free NT
Broker: IB
Trading: ES
Posts: 4,034 since Dec 2010
Thanks Given: 1,509
Thanks Received: 2,593

In the 3rd Weka course they show how to use the forecasting package and give an example of Apple stock daily values and forecasting tomorrow's closing price with the previous closes. The absolute mean error is looked at as a measure of success of the forecasting.

For daytraders having an estimate of today's closing price is not the first thing on our list of things we would like estimates of. Now for the apple stock the error is considered small by the instructor (not knowing about trading and in reference to other kinds of ML.

I got to thinking what is the baseline error?
If you give a trader a O/H/L/C daily series the very first thing to see is what is the change between one days close and another.

1. a simple prediction without ML is using yesterday's change as the estimate of today's.

others might be:
2. yesterdays close as an estimate of today's (we know this won't be correct except on most days but in a flat trend the mean absolute error could be low).
3. just using today's open as an estimate of the close
4. today's open + yesterday's change from open to close.

..........
peace, love and joy to you
.........
Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #25 (permalink)
 
aquarian1's Avatar
 aquarian1 
Point Roberts, WA, USA
 
Experience: Advanced
Platform: IB and free NT
Broker: IB
Trading: ES
Posts: 4,034 since Dec 2010
Thanks Given: 1,509
Thanks Received: 2,593

If you would like to try time series analysis - forcasting, you could download Weka, and then the forecasting add-in package. With those you can watch the youtube lesson :

Advanced Data Mining with Weka (1.3: timeseriesForecasting package)


I suggest pausing and duplicating what the instructor is doing with apple stock prices.

I have created an ARFF file for CL daily prices (see attached zip) for you to play/learn with.

Weka has data-loaders for
CSV, DB, and XLS (Excel) files. (I haven't tried the db loader). Though the xls works fine for most files, for ones with a date column it see the date as numeric not date and so I went through some machinations with notepad and then manually created the ARFF header.




Here is the Weka Explorer showing how you open the CLdaily.arff file and the Forecasting tab (which shows once you add -in the package.)


..........
peace, love and joy to you
.........
Attached Files
Elite Membership required to download: Cldaily.zip
Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #26 (permalink)
 
aquarian1's Avatar
 aquarian1 
Point Roberts, WA, USA
 
Experience: Advanced
Platform: IB and free NT
Broker: IB
Trading: ES
Posts: 4,034 since Dec 2010
Thanks Given: 1,509
Thanks Received: 2,593

I have run the CLdaily file 3 times once with each of the learning schemes.
The goal is to get the lowest Mean Abs Error.

All 3 learning schemes are about the same on test data (the last 30 percent of the data held-out for testing).
$0.79, $0.84, $0.81 (linreg, SMO, NN respectively).

on the (learning) data (first 70% of instanced) the results are
$0.98, $0.97, $1.49 (linreg, SMO, NN respectively).

(The entire 3 run results are attached in a zip)


..........
peace, love and joy to you
.........
Attached Files
Elite Membership required to download: CLruns.zip
Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #27 (permalink)
 
aquarian1's Avatar
 aquarian1 
Point Roberts, WA, USA
 
Experience: Advanced
Platform: IB and free NT
Broker: IB
Trading: ES
Posts: 4,034 since Dec 2010
Thanks Given: 1,509
Thanks Received: 2,593

I would think an obvious benchmark (equivalent to ZeroR for classifiers) for closing data is yClose.

So what happens if we just use yesterday's close as an estimate for today's close?



the ML systems didn't outperform
$0.79, $0.84, $0.81 (linreg, SMO, NN respectively)
to our benchmark $0.76

..........
peace, love and joy to you
.........
Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #28 (permalink)
 
aquarian1's Avatar
 aquarian1 
Point Roberts, WA, USA
 
Experience: Advanced
Platform: IB and free NT
Broker: IB
Trading: ES
Posts: 4,034 since Dec 2010
Thanks Given: 1,509
Thanks Received: 2,593

This is to my point about using ML intelligently.

Though ML people who are good with their systems might think $0.79, $0.84, $0.81 mean absolute errors (linreg, SMO, NN respectively) are good results, we as traders with common sense and real world experience know better with regards to trading.

Predicting the close isn't much good to a trader. Even if it were and I told you my estimate of the close was on average $0.79 from the actual you wouldn't be impressed.

$50.35 (the prediction for 21st of Sept 2017 from linreg -see data of CLrun1.txt) plus and minus $0.79 is a range from $51.14 to $49.56

I think the close on the 29th will be $50.35 but with an average error of 79 cents it could be as high as $51.14 and as low as $49.56. (and that is only the average, mean, error. It could be much wider)

---------
Actual data
2017-09-20 close = 50.69 chg 0.79
2017-09-21 close = 50.55 chg -0.14
----------

Pretty useless for trading info.
Don't apply ML blindly.

..........
peace, love and joy to you
.........
Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #29 (permalink)
 
aquarian1's Avatar
 aquarian1 
Point Roberts, WA, USA
 
Experience: Advanced
Platform: IB and free NT
Broker: IB
Trading: ES
Posts: 4,034 since Dec 2010
Thanks Given: 1,509
Thanks Received: 2,593

Apriori builds rule sets from the data.

The data must be nominal (not numeric). You can discretize your data. This is a binning process that employs enthropy heuristic (chooses split points that have the largest information gain)



Course 2.2 More Data Mining with Weka (2.2: Supervised discretization and the FilteredClassifier)


3.4: Learning association rules

..........
peace, love and joy to you
.........
Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #30 (permalink)
 
aquarian1's Avatar
 aquarian1 
Point Roberts, WA, USA
 
Experience: Advanced
Platform: IB and free NT
Broker: IB
Trading: ES
Posts: 4,034 since Dec 2010
Thanks Given: 1,509
Thanks Received: 2,593


11:47 AM 11/14/2017

In working with my dataset I found that if I used the discretization filter on the class attribute, the filter would discretize all other non-nominal attributes. I didn't want this so I am back to my spreadsheet holding my database and going through the discretizing the class attribute. The first step is to decided on the binning. Being familiar with the data of the class attribute I realized I wanted unequal binning size.

The goal is a model with the most predictive value to me for trading. Therefore, without knowing the results of the model run I can still make some decisions on binning f the class attribute.

If there are too many bins then I will not have enough instances in a bin. Too few and I will not have any predictive value.

I have 594 instances in my training dataset. I have decided on 12 bins (not all the same size).
Here is the frequency distribution of the data at equal bins each unit


The vertical blue lines are were I decided to set the bin edges

Here is the frequency distribution of the binning

..........
peace, love and joy to you
.........
Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:




Last Updated on March 31, 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