Strange behaviour with SetStopLoss during backtest - MultiCharts | futures io social day trading
futures io futures trading


Strange behaviour with SetStopLoss during backtest
Updated: Views / Replies:308 / 15
Created: by Dvdkite Attachments:6

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 6  
 
Thread Tools Search this Thread
 

Strange behaviour with SetStopLoss during backtest

  #1 (permalink)
Trading Apprentice
Trieste Italy
 
Futures Experience: Beginner
Platform: Multichart
Favorite Futures: Mini dax
 
Posts: 47 since Feb 2018
Thanks: 36 given, 5 received

Strange behaviour with SetStopLoss during backtest

Hello Everyone,

I'm test a strategy with IOG true over an year period.
I have a stop loss like this:

 
Code
SetStoploss(stopLossPoint * bigpointvalue);
As I'm testing it over the mini DAX basically a bigpoint value is 5 so the stoploss should be 50 euro like

 
Code
setstoploss(50);
Now according to the Multichart guidelines setstoploss are executed INTRABAR in any case ( IOG true or false doesn't matter) as long as the loss condition are confirmed. So I suppose that after I'm losing 50 euros it should fire a market exit order and of course I can accept a slippage but What is happened in this case?? How can it wait for 154 point BEFORE exit?? it's aroung 800 euro of loss... it doesn't make sense...

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).



I want to believe that during real time strategy automation this things cannot happen because the setstoploss should send an order to the broker immediately after the entry position so it should have been executed almost around 50 euros of loss.
Am I correct?

So how can you explain the behaviour in the screenshot? Is it a simple BUG of multichart? Of course it's not so common to see so "just" one error like this will not be a problem but I want to be sure that with REAL signal automation this cannot happen.

Regards,

DAvid

Reply With Quote
 
  #2 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,659 since Apr 2013
Thanks: 250 given, 950 received
Forum Reputation: Legendary

David,

what resolution did you use for the bar magnifier? Keep in mind at what without the bar magnifier your code will be computed four times per bar and your fills could be displayed at either the Open, High, Low and Close only.

Regards,

ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #3 (permalink)
Trading Apprentice
Trieste Italy
 
Futures Experience: Beginner
Platform: Multichart
Favorite Futures: Mini dax
 
Posts: 47 since Feb 2018
Thanks: 36 given, 5 received



ABCTG View Post
David,

what resolution did you use for the bar magnifier? Keep in mind at what without the bar magnifier your code will be computed four times per bar and your fills could be displayed at either the Open, High, Low and Close only.

Regards,

ABCTG

I have 1 tick resolution ( I supposed the lowest resolution I have then the accurate will be the backtest):

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


I still don't understand why it suppose to sell after 158 points intead of 10 (the actual stoploss points). Could it be a real bug?

Anyway I should't have any problem in real auto trading because with IOG true all the code are processed every tick , included the SetStopLoss. Is that correct?

Thanks and Regard,

David

Reply With Quote
 
  #4 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,659 since Apr 2013
Thanks: 250 given, 950 received
Forum Reputation: Legendary

David,

do you have the 1 tick data for that date in question? Try plotting a tick chart on that date.

I would check the symbol settings in Quotemanager to make sure that they are correct. Wrong settings there could result in the stop being placed at different locations than you would expect it, too.

Regards,

ABCTG

Reply With Quote
 
  #5 (permalink)
Trading Apprentice
Trieste Italy
 
Futures Experience: Beginner
Platform: Multichart
Favorite Futures: Mini dax
 
Posts: 47 since Feb 2018
Thanks: 36 given, 5 received


ABCTG View Post
David,

do you have the 1 tick data for that date in question? Try plotting a tick chart on that date.

I would check the symbol settings in Quotemanager to make sure that they are correct. Wrong settings there could result in the stop being placed at different locations than you would expect it, too.

Regards,

ABCTG

I'm currently using the Iq feed trial ,I don't think that I can use tick data so many day ago... I can only have around a month of tick data during the trial. In the screenshot I was using minutes bar (3 or 5 minutes as I remember correctly) so I have minute data.
BTW: But I didn't receive any error about bar magnifier during backtesting so I suppose it has downloaded some tick data for intrabar precision testing.


I checked the symbol in the quote manager and it seems all correct (minidax):

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).




Something similar also happen TODAY but with setbreakeven:
I was actually searching a way to move the stoploss close to the entryprice (or even above) when the position of an entry is having more than 20 tick of gain ( with 5euro of bigpointvalue it's 100$) and I decided to test the setBreakeven by this way:


 
Code
if (openpositionprofit = 100) then setbreakeven(50);
and this is another screenshot of the backtesting of my strategy applied to the miniDax today:

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


Now the signal made a short at 12015 then the price dropped down to 11976 and then up. As you can see the strategy buyToCover has been filled almost at the same price as the entry (12015). With the setbreakeven(100), that is about 20 tick of gain, the exit should have been triggered at 10 points less than 12015... so arount 12005, but nothing happened.
The exit that you see in the screenshot is correct for my strategy but it should have been anticipated by the breakeven.

Another mistery...

What do you think?

Reply With Quote
 
  #6 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,659 since Apr 2013
Thanks: 250 given, 950 received
Forum Reputation: Legendary

David,

if you don't think you have tick data for that day and assuming that there is none, the testing would have been done without the bar magnifier on that day, which in turn would explain your results.

You have configured your symbol to move in .01 intervals (the tick movement is determined by multiplying price scale and min. movement).

I would suggest checking the definition of the SetBreakEven reserved word in the documentation. It's not designed to move the stop to any other place than your entry price.

Regards,

ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #7 (permalink)
Trading Apprentice
Trieste Italy
 
Futures Experience: Beginner
Platform: Multichart
Favorite Futures: Mini dax
 
Posts: 47 since Feb 2018
Thanks: 36 given, 5 received


ABCTG View Post
David,

if you don't think you have tick data for that day and assuming that there is none, the testing would have been done without the bar magnifier on that day, which in turn would explain your results.

ABCTG

That's an interesting point and it probably explane the fact. So multichart doesn't alert you if you have barmagnifier active AND you don't have tick data.... Maybe it was my assumption to have tick data wrong.

Anyway I think I Can assume that in Automated real trading the Stop loss would be triggered and I'll never see it skipped like in the backtest


ABCTG View Post
David,

You have configured your symbol to move in .01 intervals (the tick movement is determined by multiplying price scale and min. movement).

ABCTG

That configution was the DEFAULT configuration came from the option: "use Exchange settings" and I only put the bigpointvalue at 5€.
The trades list in backtest is showing correct values for any trade so I supposed it was ok. Plus the chart work correctly and I only see entries and exits at integer values , also bid and ask are integer values like for example 12300,00 as it should be.
Can you confirm that the configuration of the symbol is ok?



ABCTG View Post
David,

I would suggest checking the definition of the SetBreakEven reserved word in the documentation. It's not designed to move the stop to any other place than your entry price.

Regards,

ABCTG

I'm confused here. Accordingly to the link and general multichart guideline the setbreaken should generate a stop order when a profit value is reached allowing to exit the position without lose and even with gain (so far from the entryprice, that's the purpose).

from https://www.multicharts.com/features/entry-and-exit-strategies/:

"....Define the profit needed to trigger this order, and once it triggers it will become active. If the price is reached, then the order will be executed."


Supposed I'm shorting at 12015 and then after the price drop below 11995 I want to be sure to earn AT LEAST 10 points. So when I reach 11995 I should generate a SetBreakeven(100) (100 is 10 * bigpointvalue in my case minidax).

I would like to understand how to protect my gain when a succesfull entry is generating for example 20 tick of profit and then set a condition that guarantee at least 10 tick in my pocket in case of drop down. I thought that breakeven would be a solution but maybe I'm wrong.

Thanks and Regards,

Reply With Quote
 
  #8 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,659 since Apr 2013
Thanks: 250 given, 950 received
Forum Reputation: Legendary

David,

in my opinion the symbol configuration is not correct, as the Mini Dax doesn't move in 0.01 increments. One of the benefits of Multicharts is that you can use a variety of different data feeds. The downside is that it requires the user to make some configurations. You should always check the symbol settings and confirm them with the exchange website (for example) to ensure they are correct. In your case it might not matter, but as soon as you are trying to compute the value of one tick or something along that lines it will matter.

Regarding the SetBreakEven reserved word it "Closes out the entire position or the entry if it is at the break even point after the profit has reached the specified value" (this is the first sentence from the wiki link.
It will not place a stop at X ticks profit. The amount you set it's one input is the amount of profit at which this order will be placed, but the stop will always be placed at the break even price.
You would have to code your own exit at break even + x ticks in case you want such an exit.

Regards,

ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #9 (permalink)
Trading Apprentice
Trieste Italy
 
Futures Experience: Beginner
Platform: Multichart
Favorite Futures: Mini dax
 
Posts: 47 since Feb 2018
Thanks: 36 given, 5 received

--------- EDIT UPDATE---------
After some test the pyramidal percentTrailing is PARTIALLY working but I still have to verify what's wrong. So I'll edit later the post to correct it. I don't want to leave wrong questions on the forum thanks...
-----------------------------



ABCTG View Post
David,

in my opinion the symbol configuration is not correct, as the Mini Dax doesn't move in 0.01 increments. One of the benefits of Multicharts is that you can use a variety of different data feeds. The downside is that it requires the user to make some configurations. You should always check the symbol settings and confirm them with the exchange website (for example) to ensure they are correct. In your case it might not matter, but as soon as you are trying to compute the value of one tick or something along that lines it will matter.

ABCTG

I thought about this a lot because even if my backtest are showing correct prices into the list of trades I'm really GETTING MAD to use some basic function of multichart like the entryprice, the setPercentTrailing, and the openPositionProfit.
At the beginning I thought it was due an error of mine during the strategy code writing. But now I'm thinking that it is possible that the funtions mentioned above are actually calculating wrong values due to wrong symbol setting. Would it be possible ?

Let me show an example. I've printed inside the block "if marketposition = -1" the openPositionProfit for my strategy over the minidax and as you can see those values are not correct because the minimum movement is 5 euro so they all should be multiples of 5 euro and not those kind of values:


 
Code
openpositionprofit is :   -6.00
openpositionprofit is :  -11.00
openpositionprofit is :  -11.00
openpositionprofit is :    4.00
openpositionprofit is :    9.00
openpositionprofit is :    4.00
openpositionprofit is :   14.00
openpositionprofit is :   -1.00
openpositionprofit is :   -6.00
openpositionprofit is :   -1.00
openpositionprofit is :   -6.00
openpositionprofit is :  -11.00
openpositionprofit is :  -16.00
openpositionprofit is :  -26.00
openpositionprofit is :  -31.00
openpositionprofit is :  -36.00
openpositionprofit is :  -41.00
openpositionprofit is :  -46.00
openpositionprofit is :  -51.00
openpositionprofit is :  -46.00
openpositionprofit is :  -41.00
openpositionprofit is :  -51.00
openpositionprofit is :  -41.00
openpositionprofit is :  -46.00
openpositionprofit is :  -41.00
openpositionprofit is :  -46.00
openpositionprofit is :  -51.00

Please note that the strategy has a lot of open positions with more than 10 , 20 even 50 points of earning with respectively should match a profit of 50, 100 even 250 euro of earning. The list above should have many many HIGHER vaues so there must be something wrong.

This would also explane why my attemp to create a sort of pyramidal percentTrailing like this is not working as it should:

 
Code
if marketposition = -1 then 
begin	 
	 if ( openpositionprofit >= 50  and openpositionprofit < 99 ) then SetPercentTrailing(50, 90);
	 if ( openpositionprofit >= 100 and openpositionprofit < 149) then SetPercentTrailing(100, 55);
	 if ( openpositionprofit >= 150 and openpositionprofit < 199 ) then SetPercentTrailing(150, 35);
	 if openpositionprofit >= 200  then SetPercentTrailing(200, 20);

....
Sometimes with my strategy I had very good earning positions that was gaining 40 points and then closed in stoploss.
So something like the serPercentTrailing would be useful to avoid those things to happen.

Anyway something around the openpositionprofit calculation must be wrong. Would you suggest me what kind of values should I set for the MINI DAX symbol? ( it is DXM# on iqfeed )?

Thanks as always,

Regards


Last edited by Dvdkite; April 5th, 2018 at 07:29 AM.
Reply With Quote
 
  #10 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,659 since Apr 2013
Thanks: 250 given, 950 received
Forum Reputation: Legendary


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

Reply With Quote
The following user says Thank You to ABCTG for this post:

Reply



futures io > > > > Strange behaviour with SetStopLoss during backtest

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Ran Aroussi: Python and Machine Learning (part 4) [special time 11AM ET]

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need example of SetStopLoss coding gdstuart Elite Automated NinjaTrader Trading 2 January 15th, 2016 02:11 AM
Setstoploss & Setprofittarget eddysmc MultiCharts 3 November 11th, 2013 02:48 PM
Renko/manual backtest/hybrid backtest BrianH NinjaTrader 0 November 4th, 2013 01:07 PM
Stopping SetStopLoss fineyfam MultiCharts 1 July 10th, 2012 04:54 AM
HOW!!?? Turn SetStopLoss into a ExitLongLimit Trader.Jon NinjaTrader Programming 2 March 26th, 2011 11:38 AM


All times are GMT -4. The time now is 01:12 AM.

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2018-04-27 in 0.09 seconds with 19 queries on phoenix via your IP 54.224.234.8