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)
My heartfelt thanks for sharing your strategy with us. I can tell the additional efforts you spent to make it simple and yet very comprehensive.
I've been studying it for almost 2 weeks now. As a newbie with minimal programming talents, my success as of this moment is having a BE condition triggered once the trade moves 8 ticks from my entry. All other efforts trying to include your Trail Stop code in different ways (that I could think of or tried) have not triggered a revised SL to protect some gained ticks even F5 compile successfully .. sigh ..
I am hoping maybe you will spare a few minutes going through my code and give me some tips on what I did wrong or how to make it work .. PLEASE!
Thank you very much .. very much in advance!
Beth
Can you help answer these questions from other members on NexusFi?
I noticed you changed CalculateOnBarClose to true. When it's set to false, Close[0] means current price, which really helps with a trailing stop. When set to true, it has to wait until the bar closes before it looks to move the stop. That could be a problem. If you can explain to me how you want the trail to actually work, I'll take a shot at it.
Your Swift response has certainly lightened me up! Days (incl 2 weekends) were spent trying to make a trail stop work. Every F5 compile successfully message gave me hope and yet it's a no no at the end. Very heart-breaking and I feel stupid when I've your master piece as my guidance.
I did try CalculateOnBarClose @ false and my supposed trail stop has not triggered anything when I backtested the strategy.
What I've been trying to do:
For example,
1. Long at 1000 with SL at 985 (initial 15 ticks SL) and BE when it moves 8 ticks from entry
2. Price moves to 1008
3. BE condition moves SL to 1000 (from 985) - that's how far I've accomplished
4. Price continues moving to 1010 (1008 + 2)
5. Trail stop kicks in with SL adjusts to 1002 (1000 + 2)
6. Price continues moving to 1012 (1010 + 2)
7. Trail stop to have SL adjusted to 1004 (1002 + 2)
.. ..
For every 2-tick move, SL will be adjusted 2 ticks to protect some gained profits.
++
I moved the trail stop code around dozens times and nothing has happened after each F5 compile successful. I'm running out of gas and that prompted to knock at your door. My heartfelt thanks for your GIANT lift!
I've obviously left some things out, but these are the parts needed for what you want to do. Remember to set CalculateOnBarClose back to false (that's why I use FirstTickOfBar in my entry code). I'm wondering if OnBarUpdate makes a difference as well, as I just realized you switched it to ManageOrders. Anyway, let me know how it goes.
BIG BIG Thank You to Dave and cbritton for your prompt code suggestion. I have them in the strategy (+ CalculateOnBarClose at false) and it's running on sim now. For backtesting, the revised strategy has generated the same results (same trades etc) as the one without the trail stop code?!!
Maybe trail stop only works when it's on live. Will find out later today and please stay tuned to my report.
The trail should would on the sim. If it isn't, we have an issue. I may have to take a peek at your actual strat if we can't figure it out here, as I'm flying slightly blind. Maybe you can change around a few things if you'd like to keep your actual signal to yourself. Good luck for now. I'll check back after market close.
Thanks Dave. No rush as I've been working on this for 2 weeks now. The strategy with trail got a little crazy after a few minutes. You will see from the enclosed log that it started to open and close a position within a second after Trade No 1. Just stopped it running.
I have a thread on my automation efforts here. I am trying to automate The Wizard's systems and the signals are well-known in the Big Mike community. Please let me know later tonight what will you need to find out what I did wrong. Thank You .. Thank You again from the bottom of my petite heart for your help!
I'm guessing you will need to add FirstTickOfBar to your entry code and set your indicator conditions a bar back. So, instead of if(Close[0] > Open[0]) go long, you would use if(FirstTickOfBar && Close[1] > Open[1]) go long. Since CalculateOnBarClose = false makes Close[0] = current price, this allows you use close as a true close and prevents the strat from taking trades on every tick, like yours seems to be doing.
If you'd like to PM me the strat or post it here, I'll have a look. It's hard to tell what will work without knowing how you want to enter.
Thanks Dave for your swift suggestion. I changed the entry conditions with FirstTickOfBar and [0] to [1] etc. Backtest results were different from the strategy without the trail (finally .. smile). Have it run on sim now and so far not generating trades every second - great news! Thanks to you.
Need to pick your brains on the following please:
1. trailProfitTrigger = 9;
8 + 1 formula with 8 being the breakEvenTicks? The trade needs to be 9 ticks away before the system starts adjusting the BE stoploss to BE + 2 ticks regularly (with 2 being the trailStepTicks), right?
2. With CalculateOnBarClose at false, I also changed the Exit condition. I'm not sure if I did correctly on the following CrossBelow:
(CrossBelow(d9ParticleOscillatorWVertLineR(7, 0).RawTrend, 0, 0)
which was (CrossBelow(d9ParticleOscillatorWVertLineR(7, 0).RawTrend, 0, 1)