Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
The code I sent for your BE and trail will do the following:
Set initial SL at -15 ticks.
Move SL to breakeven when you are +8 ticks in profit.
Move SL up two ticks when you are +10 ticks in profit and every two from then on.
You changed my original code a little but I have it move to breakeven when price = +8 and then kick in the trail when price is > 9 (which translates to 10). Subtle changes can make all the difference.
As far as your exit is concerned, if you now have it set to current bar, it should exit the instant you get a cross. If you want to make sure it closes as a cross, go back to [1]. This exit is a bit of a guess, as I don't use one and so am not certain of how it responds to FirstTickOfBar, but it's a good guess.
Let me know if I have your trail strategy right and how this works out. Again, the trail will work in simulation mode in case you don't want to wait for actual market conditions to test.
Good luck,
Dave
Can you help answer these questions from other members on NexusFi?
Thanks for your best wishes. The strategy worked funny starting 3:28, ie in-and-out within a second (per enclosed trade log). I also notice the following:
1. Trade No 4 Long @557: It went up to 582 and there's a BE SL trade @557 (cancelled status) before its closing @572. If the trail code was working, should there be some trail stop orders listed on the Orders tab?
2. Starting Trade No 6, it triggered in-and-out trades until 3:43 (you will see the trade markers on the enclosed chart).
I have absolutely no idea what I did wrong when adding the trail code. Sorry! Enclosed is my strategy with the trail code + the required indicators in case you want to run it (the strategy is supposed to work best on a 4-tick MedianRenko chart).
My super-mega Thank You for checking it for me please! Thank You .. Thank You!
The good news is I fixed your trail. Please make the following changes to your code:
SetStopLoss("Long ", CalculationMode.Ticks, 15, false); should be
SetStopLoss("", CalculationMode.Ticks, 15, false);
Also, in the trail part, (not the BE part) use:
SetStopLoss(longEntryID, CalculationMode.Price, newPrice, false); and
SetStopLoss(shortEntryID, CalculationMode.Price, newPrice, false);
The other problems you're having seem to be coming from your exit code. I ran into the same problems you did, until I commented that part out. The bad news, unfortunately, is that I don't know how to fix it. Maybe someone else more experienced with exits can give you a hand there. I'm sorry I couldn't be of more help. Let me know if you're able to solve it or if any other issues come up. And again, good luck.
Thanks Dave for making the trail work. Time to celebrate!
I've made the suggested changes and will sim trade it tomorrow. Will try both false and true for CalculateOnBarClose unless you advise that true will not work for trail. Funny that the same Exit conditions (for those without trail) have been working over a week and no looping trades.
A member opines that
"Crazy multiple trades sometimes happens when set at CalculateOnBarClose = false. I think the strat gets overwhelmed."
Let's see what may happen tomorrow before my further investigation on the Exit conditions. My heartfelt thanks again Dave!
That is strange. Maybe if I were more experienced I'd be able to do more, but I'm really just a very, very stubborn newbie. I think setting it to true will not give you the results you want but I guess it doesn't hurt to try. Keep me posted. I hope you figure out the rest.
Do me a favor. Can you add FirstTickOfBar to your exit and set the condition back one bar like we did with the entry? It just occurred to me to try this. I should have thought of it earlier.
Thanks Dave. I did set the exit conditions back one bar like we did with the entry. Just added "FirstTickOfBar" per your kind suggestion.
Close[0]<Low[1] and Close[0]>High[1] is one of the exit conditions for Long and Short respectively. I just noticed this version is more profitable than Close[1]<Low[2] and Close[1]>High[2] when I backtested the strategy. (Oh, it's an inadvertent error when I fixed the "back one bar" earlier.)
I wonder if I should keep this as-is or try both versions live tomorrow. What do you think?
I think you should go long 10 cars at open with no stops or targets and run screaming from your home! Okay, okay, I'm just kidding.
I see harm in trying both. I've read too many bad things about the inaccuracies of backtesting, so I'm all about testing live. Either way, I'll be happy if the strat works how it's supposed to.
You're right on Dave! We canNOT trust backtest results especially MedianRenko ones. I learned this after backtesting my draft strategies and got really really excited LOL! Yes, only sim results (or maybe Market Replay ones) are more reliable.