NexusFi: Find Your Edge


Home Menu

 





Strange behaviour with SetStopLoss during backtest


Discussion in MultiCharts

Updated
    1. trending_up 3,715 views
    2. thumb_up 7 thanks given
    3. group 4 followers
    1. forum 15 posts
    2. attach_file 6 attachments




 
Search this Thread

Strange behaviour with SetStopLoss during backtest

  #11 (permalink)
Dvdkite
Trieste Italy
 
Posts: 162 since Feb 2018
Thanks Given: 131
Thanks Received: 25


ABCTG View Post
David,

Multicharts will compute some metrics based on the symbol settings. This means wrong symbol settings can result in wrong results. I would suggest studying the help files regarding the symbol configuration, as it makes sense to understand what settings will affect the outcome. Otherwise you might run into the same issue again with different symbols.
This should get you going: https://www.multicharts.com/trading-software/index.php/Setting_Properties

Based on the description in the link, what settings would you suggest for the mini Dax in the MC Quotemanager?

Regards,

ABCTG

I saw so so many time that link and I didn't understand the trick till ( I Hope ) now. The Mini DAX should be:



As is should be considered as 1. So 1/1=1 is min movemente and 1*5=5 is bigpoint value.

Am I correct?

Regards

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
How to apply profiles
Traders Hideout
NexusFi Journal Challenge - May 2024
Feedback and Announcements
ZombieSqueeze
Platforms and Indicators
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
39 thanks
Just another trading journal: PA, Wyckoff & Trends
30 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
21 thanks
  #12 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628

David,

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).

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #13 (permalink)
Dvdkite
Trieste Italy
 
Posts: 162 since Feb 2018
Thanks Given: 131
Thanks Received: 25



ABCTG View Post

(others would work, too - like using a Price Scale of 1/100 and Min.Movement of 100).


ABCTG

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:

 
Code
if openpositionprofit >= 50  then SetPercentTrailing(50, 90);
	 if openpositionprofit >= 100 then SetPercentTrailing(100, 55);
	 if openpositionprofit >= 150 then SetPercentTrailing(150, 35);
	 if openpositionprofit >= 200  then SetPercentTrailing(200, 20);

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?

Instead of use

 
Code
if openpositionprofit >= 50  then SetPercentTrailing(50, 90);
shall I use

 
Code
if (entryprice - Close) >= 50  then SetPercentTrailing(50, 90);
Is there something better?

Regards,

David

Reply With Quote
  #14 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628

David,

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.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #15 (permalink)
Dvdkite
Trieste Italy
 
Posts: 162 since Feb 2018
Thanks Given: 131
Thanks Received: 25


ABCTG View Post
David,

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.

Regards,

ABCTG

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.

Reply With Quote
  #16 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,664 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,359


Dvdkite View Post
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.

Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on April 7, 2018


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts