Ok, so it’s IG Market related.. I’ll get back with some infos.
@cfta
The only thing that may cause a problem is the fix I spotted already in a recent post in this topic for this instruction:
//stoploss trigger when risk reward ratio has been reached
if onmarket and RRreached=1 then
if floatingprofit crosses under BBfloatingprofit then
SELL AT MARKET
EXITSHORT AT MARKET
endif
SELL AT positionprice-mindistancetoclose STOP
EXITSHORT AT positionprice-mindistancetoclose STOP
endif
Pending orders must be set at each new bar, that’s why I added this 2 lines in this condition as well. So when RR is reached, the trades can be exited with BBexit AND the fake stoploss at x%.
cftaParticipant
Senior
Thank you Nicolas!
I will start the real time testing right away, even though I’m slightly confused since the BB exit has worked fine when the RR has been reached and the problem has been the X % SL when the RR has not been reached. Still I’m happy to try this, I will post an update tomorrow 🙂
cftaParticipant
Senior
Good morning Nicolas,
Last night I set up the systems for 4 sets of trades, one long Nikkei, one short Nikkei (long and short on separate systems), long GBPAUD and short GBPAUD (also separetely) and I’m afraid I have some bad news already. As previously the BB exit worked great for the long Nikkei and short GBPAUD since both build up profit and then retraced but for the short Nikkei and long GBPAUD the SL was never triggered and losses are still running instead of being exited at -1 %of the account balance. Can you take a new look at the code and se what might be the prolem please?
This is my updated code for shorts;
//stoploss trigger when risk reward ratio is not met already
if onmarket and RRreached=0 then
EXITSHORT AT positionprice-mindistancetoclose STOP
endif
//stoploss trigger when risk reward ratio has been reached
if onmarket and RRreached=1 then
if floatingprofit crosses under BBfloatingprofit then
EXITSHORT AT MARKET
endif
EXITSHORT AT positionprice-mindistancetoclose STOP
endif
//resetting the risk reward reached variable
if not onmarket then
RRreached = 0
endif
Hello,
I did a lot of tests this morning and everything still OK in backtest : BBexit or normal -x% exit from account balance.
But.. there are some things I need to be sure, so I asked one of my contact at PRT about some instructions behaviour in real time @IG, so actually I wait for his feedback.
Hi again,
Seems that everything’s ok now. There were something in the demo server that did not operate correctly the pending orders. So just close and restart all strategies to see if it’s fixed.
cftaParticipant
Senior
Awesome Nicolas 🙂
I closed and restarted the strategies during lunch and later today the SL kicked in and the exits worked flawlessly! So now we know that the code is correct but I’ll keep in testing in real time demo for a few weeks to ensure there are no further server issues before trying it on my real account.
Once again you have done a fantastic job!
cfta, can you please explain how you will use it? when will you put it live? when which conditions you will go live?
cftaParticipant
Senior
@ david-1984
Please look a few pages back where I give som insight to how I trade and also provide a link to forexfactory.com.
Furthermore I’ll keep on looking for entries on H4 and H1 to start the system and run a cycle on the main indices, DAX, DOW and Nikkei along with the G7 FX crosses, paying most attention to MACD divergence, Heiken Ashi turns and CCI histogram. I will be looking for moves of 150+ pips plus with small retracements and adapting the grid step accordingly based on ATR or my general feeling of the size and the strenght of the move I antipate.
For instance yesterday I entered a short GBPJPY trade manully (one entry only without the system) at around 162.65 shortly after US open and booked profits a few hours later for about 215 pips. If i would have run that trade with the system I probably would have opted for a 15 pip grid sted with 1 contract per entry, 10 entries and 1 % risk which would have yielded a bit over 10 % before the BB exit would have kicked in.
I have a USD 10k account and trade mini contracts with IG which equates 0.1 lot or 10 000 with most other brokers so in this case my SL was roughly 100 pips. However I’m also looking into finding entries on smaller timeframes such as M5 and M1 and reduce the grid step to 3 or 5 pips and increase the number of contracts per entry to 3 or 5 with 5 to 10 entries. With 5 contracts per entry the SL start at 20 pips and then comes closer to the average entry price very fast so it is essential to find market moves of 30-80 pips which are virtually without retracements, DAX and DOW are quite suitable, but no matter the instrument it requires a high degree of precision. Last week while real time testing on demo I stared the system on the Nikkei but on full contracts instead of mini contracts which gave me about a 10 pip SL to start with but the price took off and I made a hefty 25 % profit in less than an hour.
In addition I intend to use primarily the BB exit version of the system but also the first version with a fixed SL in order to let the system run longer once in profit without being stopped out by moderate retracements.
I have been working on a market screener but have not made much progress yet towards anything useful so everyone is welcome to contribute.
And yes today’s real time tests have worked well 🙂
So if the actual code is ok for now, my next plan is to work onto dynamic step grid (which is necessary IMO).
About the screener, I believe a lot of people would enjoy discuss and give ideas on it. MACD divergence? Well why not! Do you have code about it already? or is it only spotted by eyes on chart?
About MACD divergence, I posted this one in the library today: http://www.prorealcode.com/prorealtime-indicators/macd-divergences-from-price/
It’s built upon an RSI divergence indicator but with a ZeroLag MACD version, which I prefer from the ordinary MACD.
cftaParticipant
Senior
Dynamic step grid would be a major improvement, though I guess that once a system has been initiated the grid step is the same during the whole cycle and after the stop it will turn dynamic again to set itself to the optimal grid step. I suppose the best way would be to base it on ATR, I’m uncertain of which timeframe and period which would be best though…
I spot divergence by eyes on chart but I looked into the indicator above, it looks very useful for spotting divergence and should be included in a screener, preferably along with one or two other indicators, I’m currently looking into how well CCI would fit.
I think this MACD indicator can be improved with some filters.. and time to spend on 🙂
Don’t you think that the grid step should be dynamic inside the cycle and not outside of it? I mean, if ATR rise +150% in less than 2 or 3 candlesticks, isn’t is the right time to stack more orders by reducing the step to open new ones?
Right now, I don’t understand how it can be possible to calculate the grid step dynamically outside the cycle.. Since you are the initiator of this money management strategy, your “experience” about it and your comments are welcome 🙂 Thanks.
cftaParticipant
Senior
MACD with filters would be great 🙂
You got a good point there about the ATR, my idea was that once the system is started we don’t want to see too large differences in the number of pips between each entry order, for instance looking at the drop in GBPJPY this week the ATR was rather low during the first 36 hours of the trade week so when it increased during late Tuesday afternoon and onwards we wouldn’t want a correspondingly larger grid sted. However if we reverse the calculation as you suggested and stack orders more tightly once the ATR rises is a great idea 🙂
I would also like to look into possibly adding ADX as a filter to the ATR, if the ADX value is too low, no further entries should be taken until it is above value X.
My idea of adjusting the grid step outside of the cycle would be for the system to select the most profitable grid step based on parameters X, Y and Z then maintain the same step troughout the cycle but then it lose a bit of the point and the trader can change the step manually instead.
I have to admit that I havn’t given this part of the system much tought yet so it’s open for discussion 🙂
Hello, how is it going here for everyone? Do someone has made something relevant with this money management system? Just threw up here any idea! they are welcome!