Suport&Resistance is probablly the most familiar trading indicator, I'm looking to get quick a solution from a CTrader expert developer who already did this in the past.
The trading platform which I am using is called CTrader I am using candles to analize the market.
I need Support&Resistance trading decision logic, mainly a function which is continiously running and is triggering some events if the logic is matched.
The parameters of the algorithm, the market structure elements which are analized to decide if decision condition was matched in order to trigger events are:
- no of matches of a price zone(without beeing broken by the Market Structure)
- maximum diff between matches in pips to be considered is about the same price zone (the height of the price zone = the transparent green band)
- minimum difference between matches in time to be considered is about different matches of the same price zone
- maximum difference between matches in time
- analized time (last N periods) (the width of the price zone = the transparent green band)
Parameters of the triggered events / function returnings should be structures (for both support & resistance) containing:
- price zone type: support or resistance
- price zone edges (minimum and maximum prices)
- no of price zone(support/resistance) uninterrupted matches
- total no of price zone(support/resistance) matches (in the analized time)
- number of the candles (all of them, not only the price zone matching ones) from the first touch until last touch
- the price difference between the edge candles
* a match means the upper edge of the long candle is inside the price zone or, respectively, the lower edge of a short candle is inside the price zone
Once the logic is validated an event should be triggered. The logic will not trigger events anymore unless a new match is made.
The support and resistance price zones should appear on the graph. To be easy to be followed:
- supports zones should be green and resistances ones should be red
- every found support/resistance should have a number (the numbers are starting from 1 and are increased at every found support or resistance)
- every found support/resistance should be loged in the following format: Priece=xxxxxx No of matches: x Starting Time: mm/dd/yyyy Ending Time: mm/dd/yyyy
When a support is reconfirmed the number remain the same and Ending time is set to the new time and no of matches is increased with 1
what is reconfirmation meaning: let say the minimum number of price zone matches which was set by the user to consider the price zone a support is 3. At 15.03 the 3rd point is on the same zone with other 2 and the price zone is confirmed as a support, Ending Time: 15.03. But at 16.15 a new point, the 4th one, is on the same zone with the previous 3 so the support is reconfirmed so the new Ending time will be 16.15 and the number of the matches will be 3+1=4.
An example was provided in the attached screenshoot.
the transparent green band is the demand band. the height of the band is a parameter of the algorithm
Let's say the other parameters are:
- no of matches of a price zone(without beeing broken by the Market Structure) = 3
- minimum difference between matches in time to be considered is about different matches of the same price zone = 5 periods
- maximum difference between matches in time = 50 periods
- analized time (last N periods) = 100 periods
* period is m1, .. m30, h1...
So in the picture let's say we start the script at 15.00 on Sept 29
We don't observe anything until 23.00 on Sept 30 (red A), when the second touch of the zone is confirmed (we have price outside the support zone) but we have only 2 touches and is not enought number of touches should be 3
But at red B we have the 3rd exit from the price zone and here we can have a buy. Here we should go back in time and dethermine the last price zone. We will have a buy order in point B with an exit when the price touches prev time zone.