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)
Strange behaviour with SetStopLoss during backtest
looks good. In general multiplying Price Scale with Min. Movement should give you one tick of the underlying. If this is not the case, the settings are wrong. So here the result has to be 1.00 (for the smallest movement of the underlying) and you can achieve this with your setup (others would work, too - like using a Price Scale of 1/100 and Min.Movement of 100).
This is good to know too, I also corrected the big DAX with 1/100 and 50 min mov with bigpoint 25..... so 0,5 is min tick with tick value of 12,5. I think I got it now.
About what I said above related to openpositionprofit and percentTrailing, I need to understand what sometimes the SetPercentTrailing are not triggered.
EXAMPLE: I have those pyramidal trailing code inside "if marketposition = -1" block:
and now please look at the second stop loss on the righ of the chart:
The short has been made at 12255 and the stop loss (10 tick fixed) has been taken at 12266. Now, in the bar BEFORE the green bar of the stop loss you can see (I left the data window details over the bar I'm talking about) that the MINIMUM was 12237 so 18 points below the entryprice. Now I CANNOT understand why the first SetPercentTrailing(50, 90) has not been triggered. 50 is the gain of 10 ticks so with 90% of loss of those 10tick (=9tick) it should have been exited almost at the entryprice+1 but it didn't happen. It clearly reached 18 ticks of gain before goes up to the SL so I was wondering WHY things like this happen?
I know that SetPercentTrailing is calculated intrabar. And what about openPositionProfit?
Could it be that the problem??
Is there any more safe way to code the trailing exit?
the build in exit reserved words are best not used within conditions. Without knowing your entire code one could only guess, but using these reserved words conditionally might make them subject to being evaluated end of bar only (depending on your code).
If you must change the parameter values of such a reserved word, calling it once (unconditionally) and using variables for the parameters (and changing the variable values when your conditions are met) might be better than calling it multiple times in the same code.
This is good to know. I've tried to create some parameters as the profit and the percent for the trailing and I used that in the conditions and then in the code I simply set one time the SetPercentTrailing with the parameters inside and now I suppose that the SetPErcentTrailing is updated as soon as it detect that new values for the profit and the percent are set.
Sure it look a better solution ... and it works better than the continuous calling solutions but it still miss some calls...
Later I tried to use in another strategy SetPercentTrailing(230,20) on another strategy... and just for testing I've tried to DECREASE the value of the percent from 20 to 15... then 10.. then 5... till 1. I was incredible how decreasing the percent of the trailing DRAMATICALLY increase the net profit of the strategy....
For example the backtest of my strategy over 2 years period with SetPercentTrailing(230,20) showed a net profit of 40000 dollars and with SetPercentTrailing(230,1) showed a net profit of 95000 dollars...
This is clearly a backtest not trustable indeed looking to the List of Trades with SetPercentTrailing(230,1) ther was trade closed with 400, 500 even 750$ of profit and THERE'S NO WAY it can happen with a percent of "1" set !
I know it was an extreme settings but I cannot believe that with a retracement percent of 1 it close trades with twice or even third times the profit set in the SetPercentTrailing. It simply cannot happen in reality.
So How can SetPercentTrailing can be TRUSTED in a backtest??
What is the lowest percent for SetPercentTrailing(profit, percent)TRUSTABLE in a backtest??
BTW: I'm testing it over a signal applied to the DAX chart with 5 minutes , precision backtesting with bar magnifier activated and IOG off. I've specified IOG off because according to the multichart guidelines SetPercentTrailing are calculated intrabar ANYWAY (the same way as SetStopLoss etc..) so it shoulsdn't matter if IOG is true or false.
I do not trust SetPercentTrailing or SetDollarTrailing at all. I heard they might work OK with LIBB = 1 tick resolution, but then you only have 6 months of historical data.
I tell traders I work with to NEVER use those 2 functions.