OmniTrader Professional Forum OmniTrader Professional Forum
forums calendars search
today this week
 
register logon control panel Forum Rules
You are currently browsing as a guest.
You should logon to access more features
A Self-Moderated Community - ALL MEMBERS, PLEASE READ!
Vote for Members who contribute the most to your trading, and help us moderate content within the Forums.


  Current location        Thread information  
OmniTrader Pro Resource Forum
OmniTrader Pro Technical Support
Possible Error in PortSim and Advisor
Last Activity 6/17/2025 3:19 PM
10 replies, 946 viewings

Jump to page : 1
Now viewing page 1 [25 messages per page]
 
back reply
Printer friendly version

^ Top
John W

Regular
252525
Posts: 96

Joined: 6/18/2011
Location: Sydney, NSW, Australia

User Profile
 
Subject : Possible Error in PortSim and Advisor
Posted : 5/24/2021 12:42 AM
Post #31496

I recently noticed some differences in actual trades and the PortSim results.

It appears that the Advisor and PortSim do not use the correct exit price when the market opens below the stop and the market then reverses and rises.
The market open price is below the stop and should be used in the calcs, but instead the higher stop price is being used incorrectly.

This can lead to significant errors in backtesting and ongoing profitability reporting in Port Sim.

The Advisor and PortSim do work correctly where the market opens below the stop price and the market then continues to fall below the open price.
In that case the market open price is correctly used for the calc.

An example is shown below using the default broker Trade Plan:




[Edited by John W on 5/24/2021 12:47 AM]

Attached file : incorrectstopcalc.jpg (231KB - 586 downloads)

^ Top
Jim Dean

Sage
2000100010010010010025
Posts: 3433

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Possible Error in PortSim and Advisor
Posted : 5/24/2021 6:42 AM
Post #31497 - In reply to #31496

Hi John

Just a thot. Does your TradePlan stop use a Mkt order or BOO?

And, either way, have you tried it without the Broker flag being selected?
^ Top
John W

Regular
252525
Posts: 96

Joined: 6/18/2011
Location: Sydney, NSW, Australia

User Profile
 
Subject : RE: Possible Error in PortSim and Advisor
Posted : 5/25/2021 2:37 AM
Post #31498 - In reply to #31497

The Trade Plan uses a market order. There is no difference in result whether or not "use enabled stop as a broker stop" is selected.

I've played around with this for a few hours now (honestly I don't know how Barry does this!)

What I figured out is there are two alternate cases. The first case is in my earlier post - a MOC order is placed, a stop is placed below the close and the next bar opens below that stop, and the next bar then goes up.

A second situation is shown below. Its the same principle but with the next bar continuing down. The Trade Advisor simulates that the trade is closed at MOC, it closes the trade on the originating MOC bar without profit or loss.



[Edited by John W on 5/25/2021 2:38 AM]

Attached file : Falling.jpg (197KB - 544 downloads)

^ Top
Jim Dean

Sage
2000100010010010010025
Posts: 3433

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Possible Error in PortSim and Advisor
Posted : 5/25/2021 5:28 AM
Post #31499 - In reply to #31498

I agree re Barry’s skill and patience. Bigtime.

I didn’t notice before that the exit was attempted on the Open of the bar right after the Entry on Close of the prior bar.

OT sort of has trouble with distinguishing the transition between bars. For many things it doesn’t really “know” that a bar has ended, until the next one begins. I think that may be in play here.

If you’ve got the fortitude to try another test, my fingers crossed guess is that if there is a one bar or more delay between the MOC entry and an Open that crosses below a stop level, then it might work properly. If so, that piece of info should help the programmers to focus their work.

To do this, make Step 2 be an NBar=1 condition that jumps to Step 3 that sets the Stop level.
^ Top
John W

Regular
252525
Posts: 96

Joined: 6/18/2011
Location: Sydney, NSW, Australia

User Profile
 
Subject : RE: Possible Error in PortSim and Advisor
Posted : 5/25/2021 7:21 AM
Post #31500 - In reply to #31499

Thanks Jim!

Using my last example, adding a 1 bar delay with the same $54.64 entry and the $54.00 stop causes the Advisor to record an exit on the open of 7/20 (second red bar $51.88), unfortunately that's a bar late.
[I used "adjust entry stop based on Current bar Entry Price)". The 3 other entry stop adjustments were not appropriate.]

Ideally the Advisor should record an exit on the open of 7/19 (first red bar $53.05).

Hope that helps!
^ Top
Jim Dean

Sage
2000100010010010010025
Posts: 3433

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Possible Error in PortSim and Advisor
Posted : 5/25/2021 8:29 AM
Post #31501 - In reply to #31500

Yea that’s what the example was supposed to do. I suggested it to help diagnose the issue.

BARRY: please read thread details. This issue occurs ONLY when the exit triggers on the bar immediately after the MOC entry.
^ Top
SteveL

Veteran
10025
Posts: 133

Joined: 2/15/2007
Location: Boulder, CO

User Profile
 
Subject : RE: Possible Error in PortSim and Advisor
Posted : 5/25/2021 8:31 AM
Post #31502 - In reply to #31500

John, I'm glad you found this. This is obviously a problem for PortSim results. Hopefully this can be fixed.
^ Top
Barry Cohen

Idol
2000100100100
Posts: 2309

Joined: 1/1/1900

User Profile
 
Subject : RE: Possible Error in PortSim and Advisor
Posted : 6/8/2021 5:39 PM
Post #31514 - In reply to #31496

Sorry I'm just now getting to this. It's been pretty hectic with VT lately. John, can attach that "0 Example Stop error" strategy?
^ Top
John W

Regular
252525
Posts: 96

Joined: 6/18/2011
Location: Sydney, NSW, Australia

User Profile
 
Subject : RE: Possible Error in PortSim and Advisor
Posted : 6/9/2021 4:31 AM
Post #31515 - In reply to #31514

Barry, the simple strategy is attached. Its set for the second example, you need to tweak the filter and TP to reset the strategy for the first example.
Attached file : 0 Example Stop Error.ots (644KB - 261 downloads)

^ Top
Barry Cohen

Idol
2000100100100
Posts: 2309

Joined: 1/1/1900

User Profile
 
Subject : RE: Possible Error in PortSim and Advisor
Posted : 6/14/2021 2:47 PM
Post #31516 - In reply to #31515

Thanks, so the issue looks to me like a very specific case when the entry is a MoC order & the next bar exits the trade. I'll report it. It seems to work correctly if the entry is a Market or MOO or if the Fixed Loss is based off the Current Bar Open Price instead of Entry Price.
^ Top
Jim Dean

Sage
2000100010010010010025
Posts: 3433

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Possible Error in PortSim and Advisor
Posted : 6/14/2021 3:09 PM
Post #31517 - In reply to #31516

Barry: Yup.
Jump to page : 1
Now viewing page 1 [25 messages per page]
back reply

Legend    Action      Notification  
Administrator
Forum Moderator
Registered User
Unregistered User
E-Mail this thread to a friend
Toggle e-mail notification


Nirvana Systems
For any problems or issues please contact our Webmaster at webmaster@nirvsys.com.