Math.Abs() erratic outcome in strategy - NinjaTrader Programming | futures io social day trading
futures io futures trading


Math.Abs() erratic outcome in strategy
Updated: Views / Replies:1,087 / 5
Created: by Trader.Jon Attachments:1

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
 
Thread Tools Search this Thread
 

Math.Abs() erratic outcome in strategy

  #1 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received

Math.Abs() erratic outcome in strategy

Another week, another challenge,

I had a bunch of erratic outcomes in backtesting so I stripped down the code and ...

Using the PRC2 from the downloads area, and NOW the only condition in the strategy is the Math.Abs portion of the code

My pseudo code [idea to test]

IF the (Absolute Value of the ((PRC2.SqHI2 minus HIGH) is GREATER THAN
( the Absolute Value of the ((LOW minus PRC2.SqLOW2 ))
Then Go LONG ...

ie there is more potential to go up than there is to go down if that is true. The reason I am using Abs is to cover cases when the HI might already be greater than the Sqh2 .... reversing logic to go shorts ... on the screen shot you will see that the trigger bars are (in this example) in position to take SHORT, but 1 went LONG instead.. 33.3333% of trades going the wrong way do not a happy tester make!

Likely it is my mis use of the tool, but I dont know any better lol

Thanks especially for a fix ... been hitting on this all weekend trying to find the problem
Jon


 
Code
                            
 

if
(
Position.MarketPosition == MarketPosition.Flat 
&& (Math.Abs(PRC2(PRC2DegreePRC2Period1.622.00PRC2HATEMAPeriodPRC2TEMAPeriod).Sqh2[0] - Highs[0][0])) >
 (
Math.Abs(Lows[0][0] - PRC2(PRC2DegreePRC2Period1.622.00PRC2HATEMAPeriodPRC2TEMAPeriod).Sql2[0])) 
)
// go long 

Attached Thumbnails
Math.Abs() erratic outcome in strategy-math.abs-.errors.jpg  

Last edited by Trader.Jon; November 21st, 2010 at 10:35 PM. Reason: screenshot
Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received


I believe Math.Abs simply ensures the return is a positive number. Is that what you want?

For example Math.Abs(-24312) returns 24312, and Math.Abs(24312) returns 24312.

Reply With Quote
 
  #4 (permalink)
Market Wizard
virginia
 
Futures Experience: Intermediate
Platform: ninja
Favorite Futures: ES
 
cory's Avatar
 
Posts: 5,215 since Jun 2009
Thanks: 628 given, 6,313 received
Forum Reputation: Legendary

prc is probl the most heavily repaint (recalculation) indicator.

Reply With Quote
 
  #5 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received


MXASJ View Post
I believe Math.Abs simply ensures the return is a positive number. Is that what you want?

For example Math.Abs(-24312) returns 24312, and Math.Abs(24312) returns 24312.

Cory,

Thats the plan ... it is ... just the way the results come out it has no pattern that I can determine what the error comes from. The screen shot shows two very similar, consecutive entries, but one is long and the other short.

Jon

Reply With Quote
 
  #6 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received


cory View Post
prc is probl the most heavily repaint (recalculation) indicator.

Cory,

I appreciate the analysis.

I have looked at the code, I cant really see where it recalculates ... but it is definitely too complex for my wetware.

Any thoughts on a version that doesnt recalculate, or let it recalculate but only allow changes to the current bar? Something like a 'window' to stop changes to already plotted data?

Jon


Last edited by Trader.Jon; November 22nd, 2010 at 03:43 PM.
Reply With Quote

Reply



futures io > > > > > Math.Abs() erratic outcome in strategy

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Murrey Math Big Mike Traders Hideout 225 Yesterday 06:41 PM
C# Math Library MXASJ Matlab, R project and Python 15 April 14th, 2015 07:11 AM
The Erratic Method (random entries) Big Mike Elite Automated NinjaTrader Trading 58 November 16th, 2014 07:25 AM
Murrey Math automated strategy for NinjaTrader Big Mike Elite Automated NinjaTrader Trading 22 October 2nd, 2012 10:18 AM
C# Math.net and compiling tinkerz NinjaTrader Programming 1 April 6th, 2010 06:33 PM


All times are GMT -4. The time now is 02:15 PM.

Copyright © 2017 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 2017-12-12 in 0.10 seconds with 20 queries on phoenix via your IP 54.163.209.109