Help with testing a strategy: going from idea to script.

Hello everyone,

I am new to scripting and it comes on top of a few years of learning a lot of TA, getting profitable at trading, etc. so I want to
be efficient with time spent on any new learning - i.e. trying to seek help and then get stuck in learning the necessary bits
but not actually have any ambition to become an expert.

The main difficulty is how to quantify my trading strategy, which is quite fluid, in a way that Optuma ready-made scripts would understand.
I trade fx spot and tend to either trend-trade or range-trade, depending on conditions. My main concern in both is that there is enough momentum
to go from one whole number level to the next.

The question is how to make this testable in a scripting, computer-driven way…

Here is a possible sequence of thought processes that I use when deciding if taking a trade; let us take EUR/USD as an example:

  1. look at price in relation to the nearest whole number levels: if it is above the half-way mark, e.g. 1.1850, but below the 3/4 way (1.1875) then I would
    think about going long; if below the half-way mark, but above the 1/4 mark (1.1825) then I would think about going short. Then I would look at…

  2. the intra-day candles leading up to that price, to see if we had ‘leg’ in the move up or down; then…

3)… I would go over to CME’s Euro futures and check the hourly volume bars to see if volume confirmed the move or not;

  1. … if still in doubt, I would go over to CME’s Euro options open interest heatmap and check the bullish/bearish sentiment looking at the rate of change
    in calls and puts at the price levels nearest price action (and further up/down);

  2. sometimes I would also look at ATR to see if the range was expanding or shrinking, again to see if the move had momentum or lacked ‘oomph’;

  3. for situations where price experienced many days of congestion I would also keep an eye on RSI for divergence if at extremes (I tend to look at 4H
    or higher timeframes and set my overbought at 80/ oversold at 20).

When I automated my trades, i.e. very simply put in limit orders (as ‘set and forget’ trades), I tend to set the long entries above the next whole number
level from 25 pips up, thus using a filter of 25% of the 100-pip range between the two whole number levels, to avoid false starts, and for selling I do the
same in reverse (i.e. from 25 pips below a whole number level).

Question is: how does one even begin getting something like this scripted? It seems too difficult and also I am not sure how looking at fading volume in relation to price, which I do discretionally, could be quantified.

In essence, I am trying to coming volume /open interest data from the futures / options side into my decision-making over on the spot charts, so that
trading currencies (notoriously lacking in volume data) on the spot side can benefit from using confirmation from sentiment.

I know that some studies concluded that spot fx price leads that of fx futures, given its much larger size, but I do think (from watching this day after day, week after week) that there may be something in it, i.e. that the futures volume data and the options open interest figures can become integrated in the decision-making of trading currencies. Ideally it could all be tested to give me an idea of how much ‘leg’ there was in the idea, and if parameters could be tweaked to my advantage.

Does anyone have any advice on how to get this idea down into a format that is test-ready?

Thank you so much.

Francesco

PS: I do not expect a ‘here is how it is done’ but just want to know if something like this CAN be scripted in Optuma (or anywhere).
I am quite happy to book a consultation with Optuma and pay for that, I am just trying to get a sense of what I should do next.
Any advice, no matter how vague, would be appreciated.
I hope I have not broken any forum rules…

Hi Francesco,

Just a quick reply now to let you know that I will have a look at this on Monday.

All the best

Mathew

[postquote quote=61677]

Dear Mathew,

I am grateful for your reply and may I take. the opportunity to thank you for all the
videos and accompanying notes you made
for preparing toward the. CMT exams.

I am also grateful to Darren for his time yesterday as he tried to answer my questions
about Optuma in our consultation.

I know you will have many people saying the same thing but I cannot praise you enough for doing so much to help elevating technical analysis from voodoo status to something that is akin to science thus requiring study and a systematic approach.

I chose the CMT route because as a private trader it was the only financial certification that seemed to truly speak to me - of course there is the CFTe, but that is a discussion for another thread! - and seeing someone of your standing also believing in the value of the CMT programme (enough to produce hours and hours of video content was a decisive factor in me going through with it.

I. hope to pass my exam next week, but whatever happens you and Optuma have my gratitude.

Francesco

Hi Francesco,

Thank you for your kind words.

Some thoughts:

  1. Why do you base your rules on "whole numbers". There is some evidence to suggest that whole numbers are psychological support and resistance levels, but usually, that is more in the area of indexes making new all-time highs etc. I can think of no reason why a trade with all the other qualifications would not work just as well at any price. I would suggest a deep signal analysis study to see if this is indeed something which has a high probability of gain. Without doing signal testing, we are prone to confirmation bias and selection bias when we visually inspect charts.
  2. The big issue we will have is that all the Optuma testers are for daily time frames and higher. The main reason for that is that we do not provide the data and testers need to have very clean and precise data. The secondary reason is that in 25 years of providing these services, I've seen who survives in the markets and who does not. Generally speaking, intraday traders do not survive, while daily and weekly traders are still using our services more than 20 years later. You certainly may be the exception, but the probabilities are stacked against you.
  3. On top of point 2, we do not have the options data to confirm this either. We are adding in options data as daily, but we do not have the intraday data to do so.
  4. Data aside, you need to be able to define terms like "Congestion" mathematically. What determines if it is in congestion and can it be scripted? You need to define exactly what congestion looks like.
  5. At this point, Optuma will not auto-trade for you. Our tools are focussed on the analytics and the statistical justification behind a trading decision. As we move to web-based solutions over the next few years, that may change, but no time soon.
I think the idea of using futures volume as a proxy for Spot volume is very interesting. Again, there would need to be a lot of research into it to see what the leading effect of the futures has. It would almost be a correlation study between Futures Volume and Spot Price.

In summary, I think this would take a lot of work. We’d need to get the data downloaded for the FX pairs and the Options. We’d need to define all the rules. I’m sorry to say but it does not look like we can help you achieve all that you want to do.

All the best

Mathew

Hello Mathew,

thank you, I really appreciate the time you took to answer and think this over.

The CMT text (level 1) says at some point that whole numbers should not really be something people should pay too much attention to. I (respectfully) disagree
and if you look at fx options on CME it is plain to see how open interest stacks up on those levels (and the half-number levels, e.g. 1.1850, 1.1950, etc.). Sure, apart from my own experience observing this in the last few years, I would say that this is an fx thing, perhaps, more so than a stocks/equities thing. And these whole-number levels are not just for intraday, in currencies: they stretch back and forth through time.

To conclude: I would like to signal test selling when approaching a whole-number level and bouncing against it (= resistance) with the added condition of rising sell volume, all of which can be quantifiable (e.g. two or three successive sell-volume increases from the point of bounce, for example). It would be a case of seeing how many signals this would generate at each successive move up to the next whole-number level. Then, a test would be done on the reverse, i.e. buying on a break above the resistance level, again on condition that buy volume were rising.

In essence: I want to test the relationship between volume and buy / sell signals in fx futures. CME have just released a new tool, the FX Market Profile (https://www.cmegroup.com/trading/fx/cme-fx-market-profile-tool.html), which compares volume and spreads for spot and futures fx, specifically CME futures and the EBS spot. What this also shows is volume comparison intra-day, which could help in determining the most active hours overall to test signals for.

As always, I have years of observing charts but testing is a different thing. I would like to use signal testing to quickly answer questions that could otherwise take me even more years to answer, all in the pursuit of making my trading less subjective and more based on the wider view (supported by facts).

I looked up IQ feeds today but they are not free therefore I do not think it is for me - the CME futures charts may not feed directly into Optuma but they are fully functional and…free. I think if I were to make the decision of investing in one significant piece of software I would hope to have the few things that I needed in one place, rather than having to go off and buy more and more things. Maybe there are other ways of testing my ideas at this moment in time, so you could be right, it may be a good idea for me to take your input and try to find a way to break down my trading into a measurable sum.

Thanks for all your help and I hope to find a way forward.

F

PS: there has been research done on whether futures lead spot in fx prices, of which I only saw these two fairly recent studies:

https://www.newyorkfed.org/medialibrary/media/research/staff_reports/sr262.pdf
file:///C:/Users/tetra/Downloads/Do%20Futures%20Lead%20Price%20Discovery%20in%20Electronic%20Foreign%20Exchange%20Markets.pdf

What the market tool from CME shows is that the same currency pair in futures and spot can have more or less beneficial spreads (top of the book)
therefore it may sometimes be better to trade spot for a futures trader, and vice versa. The size of the futures fx market is tiny in comparison to the spot fx one
but the latter is decentralised and if one could not trade straight from futures it could be worth taking a look at testing this idea of volume and levels on the futures side - and then basing trading decisions on those findings when trading spot.

Take care
F

Sorry, try this link instead - that was my locally saved version displaying as a link -

https://www.forexmentoronline.com/wp-content/uploads/2015/11/10.1.1.150.1303.pdf

Hello again.

It seems that there is a way to script a test of ‘whole’/‘round’ number levels… I have just had a few weeks of research, including speaking to InvestiQuant and to TradeStation, and finally reached out to the community in TradingView: I have been told that there is certainly (at least in Pine scripting) a code for testing price signals around whole numbers and/or % above/below these numbers. I just wanted to share this with you. I have a journey ahead - learning the scripting myself or using existing code from the public library in TV and adapting it - will keep me busy. Thanks for all your help x x