Principle of the trading system “Higher volatility”:
The system looks at the last X candles and determines the candle having the biggest difference between its highest and its lowest (range), the difference Z is then kept as a variable. This is the gap between the highest and lowest of the candle having had the highest volatility on the last X candles. At the candle X + 1, the system waits (in all cases) the fence. At the closing of the candlestick X + 1: If the range between the highest and lowest candlestick X + 1 is greater than the Z range, the system opens (at the opening of the candlestick X + 2 ) a position in the direction of the candlestick X + 1. If the deviation between the highest and lowest of the candelstick X + 1 is not greater than the deviation Z, the deviation Z is then re-calculated as a function of the X newest candlestick.
Parameters and system options “Higher volatility”:
1 / Size of the position: in number of contracys.
2/ Stop loss: to determine how many pips / points of the entry price will be positioned the stop loss of an open position.
3 / Take Profit: To determine how many pips / points of the entry price will be positioned the take profit of an open position.
4 / Quantity of lookback periods: to determine the number of candlesticks to be consulted in order to determine which was the most volatile and to calculate Z.
Example: 1/10 2/60 3/30 4/10 That the system consults the last 10 candlesticks and determines the deviation Z of the most volatile candlestick. At the opening of the 11th candle, the system does nothing. It waits for the closure of this 11th candle to know what to do … If the range of this 11th candle is greater than Z, the system opens a position at the opening of the 12th candle in the direction of this 11th candle. If the deviation the higher-lower deviation of this 11th candle is less than Z, the system re-calculates Z.
NB in case of opening of position at the opening of the 12th candle: Open a position at the 12th candle (is that the 11th candle was more volatile than the previous 10 candles …), the system must be able to open a position at the 13th candle in the sense of the 12th candle , If (at the close of the 12th candle) the 12th candle was more volatile than the 11th candle …
//PRC_Higher Volatility TS | strategy
//10.03.2017
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
defparam cumulateorders = true
// --- parameters
Size = 1 //position size
StopLoss = 60 //stoploss in points
TakeProfit = 30 //takeprofit in points
LookbackPeriod = 10 //lookback period to find the bigger candlestick range
// ------------
biggestrange = 0
for i = 1 to LookbackPeriod do
biggestrange = max(biggestrange,range[i])
next
if range>biggestrange and NOT ONMARKET then
//case buy
if close>open then
BUY Size CONTRACTS AT MARKET
endif
//case SELL
if close<open then
SELLSHORT Size CONTRACTS AT MARKET
endif
endif
SET STOP PLOSS StopLoss
SET TARGET PPROFIT TakeProfit
This trading strategy has been coded by a request on the French forum. Please consider that there is no typical settings and it is not dedicated to any instrument or timeframe at all. This strategy is almost like a “sandbox” for studying purpose and to define suitable parameters for your preferred instruments.
You must be logged in to post a comment.
oh yes, i see. thank you very much
bonjour voud pouvez m envoyer le code modifier par vous?
hello nicolas. what is the difference between "pprofit" to "profit" thank you
What are you calling a finished strategy? This one has been coded by a request on forums, since it's a request made by a webmaster from another trading website to promote prorealcode, I preferred to add it to the library instead of loosing its link in forum. It doesn't mean this one should be traded as is, but I believe that the way it is coded should be of interest of many coders apprentice around here. Prorealcode is about programming, sharing trading ideas and automated trading analysis, take benefits of everything you'll find here by studying them, not just by downloading them, no disrespect :)
Is there any way to simulate this? I ran even on 10 seconds time still it is producing astonishingly wrong results with comparison to mock runs