NexusFi: Find Your Edge


Home Menu

 





script idea


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one sharky with 22 posts (7 thanks)
    2. looks_two systrader with 11 posts (31 thanks)
    3. looks_3 Peter with 6 posts (10 thanks)
    4. looks_4 zeller4 with 4 posts (1 thanks)
      Best Posters
    1. looks_one systrader with 2.8 thanks per post
    2. looks_two sam028 with 2 thanks per post
    3. looks_3 Peter with 1.7 thanks per post
    4. looks_4 sharky with 0.3 thanks per post
    1. trending_up 22,342 views
    2. thumb_up 58 thanks given
    3. group 11 followers
    1. forum 64 posts
    2. attach_file 14 attachments




 
Search this Thread

script idea

  #31 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,442 since Jun 2009
Thanks Given: 33,215
Thanks Received: 101,603

The yellow line issue, discussed at length in chat, is due to the precision being used in DoubleMA Paint. What is painted on screen vs. what is passed in the DataSeries is different due to this math rounding (precision).

Approximately line 147 the rounding begins. I'm not the original author and do not know why the rounding is necessary.

If you replace:
double val1 = Math.Round( val1Pure, decimals );
double val2 = Math.Round( val2Pure, decimals );

with:
double val1 = Math.Round( val1Pure, 6 );
double val2 = Math.Round( val2Pure, 6 );

Then the issue with the yellow color should be fixed on the ZN instrument.

If someone wants to get more at the heart of this for a real solution, the logic to determine the number of decimals begins on line 83 of DMAPaint.cs.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
22 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #32 (permalink)
 
Peter's Avatar
 Peter 
Brisbane; Australia
 
Experience: Intermediate
Platform: NT
Broker: IB/TDA needing new broker
Trading: Futures, Forex, Stocks
Posts: 97 since Jun 2009
Thanks Given: 91
Thanks Received: 118

The versions are in fast development. Here are the latest....

The ZIP contains 2 variants of the same strategy
- SharkyMAStrategy_v1_05
- SharkyMAStrategy_v1_05_DMV_version

The first version uses the Signal dataseries to trigger entries and exits
The second (even more experimental) DMV version uses the DMV dataseries in DMAPaint to trigger entries/exits.

The ZIP includes:
- an updated DMAPaint and updated DMA with:
1. Mike's fix as per previous post
2. updated DMAPaint to default PaintBar=false (so it does not repaint the bars by default
when putting the the DMAPaint or DMAPaint containing strategy on a chart)
3. DMA changed to PriceSupported = true
- my updated Internal (adds TEMA, ZeroLagTEMA and ZeroLagHATEMA as choice) .


For details see earlier posts

The strategies are work in progress ... do not use for real trading

Just (8.00 AM) uploaded again a new version. Found logical error in the DMV version that prevented it going short.
(8.32 AM) It looks like there is still a bug in the logic of the DMV version as it re-enters while the code should prevent this.
But still useful to see if using the DMV dataseries gives different entries than using the Signal dataseries

As Max suggested and we discussed in the chat it might be better to hardcode the logic directly without using the DMAPaint
with e.g. statements like .......if ZerolagEMA(ZeroLagEMA,13),13
[0] > ZeroLagEMA(ZeroLagEMA,13)13 [1] etc.
We agree that this is probably the best way forward. But that's for another day .... or one of the others to pick up.


8.15 PM I checked what the 2 versions did last night. The version based on the DMA Signal dataseries and the version based on the DMA DMV dataseries definitively triggered differently.
I think somebody else better first checks the trigger logic. You tend to miss flaws in your own coding.


As mentioned yesterday it is probably better as next step to first hard code the logic in the strategy with statements like
- ZerolagEMA(ZeroLagEMA,12),12 [0] > ZeroLagEMA(ZeroLagEMA,12)12 [1]
- or
ZerolagEMA(ZeroLagEMA,12),12 rising etc.
That way we would no longer be dependent on the inside logic of the DMSPaint indicator.
With 'hardcoding' I mean here 'not using the DMA'. I would still make the period of the ZeroLagEMA a changeable parameter.


That would give then 3 versions to compare and evaluate the efficacy / correctness of the triggers.
It is fun the develop on the fly, but IMO we need to get a little structured in the approach.

Don't know if it is wise to already put in break-even and ATM type stuff and complicate the strategy before solving the first part.

Will have little time rest of the week ... so if somebody wants to pick up ... pls do


Attached Files
Elite Membership required to download: SharkyMAStrategy_v1_05c__2versions.zip
Reply With Quote
Thanked by:
  #33 (permalink)
systrader
Rocky Mountains
 
Posts: 19 since Jun 2009
Thanks Given: 17
Thanks Received: 37


Back from a long weekend. Looks like a lot has changed in the script(s)! I'll try to catch up and figure out what all has changed. Let me know if I can help with anything.

Reply With Quote
  #34 (permalink)
 KJAVED 
Toronto Canada
 
Experience: Intermediate
Platform: ninja Trader, Ensign,Market Delta
Broker: AMP,Global Futures
Trading: Eminis
Posts: 97 since Jun 2009
Thanks Given: 46
Thanks Received: 83

Thanks for posting this idea . I have one idea about profit management. If you make it to configure profit management through ATM strategy, then it will be better.

Reply With Quote
Thanked by:
  #35 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 477 since Jun 2009
Thanks Given: 1,416
Thanks Received: 404

systrader,

I'm curious if your strategies are normally using ATM strategy or IORDER?

I've not conquered either one yet but have samples of each and am still learning the nuances.

Also, are you normally using Add(name of indicator) in Initialize? or do you just add the indicator separately?

Kirk

Reply With Quote
  #36 (permalink)
 KJAVED 
Toronto Canada
 
Experience: Intermediate
Platform: ninja Trader, Ensign,Market Delta
Broker: AMP,Global Futures
Trading: Eminis
Posts: 97 since Jun 2009
Thanks Given: 46
Thanks Received: 83

I am not Programmer. But have some knowledge. I hire some ninja script consultants before my strategies. They configure it for me. Your all strategy ok, working good, except profit management. For profitmanagement, you can make as manay ATM strategies as you want and just put there name at start of strategy from strategy wizard. Then it automatically picks that specific ATM strategy.
When this happen, then there is no need to give profit/loss/trail tragets inside strategy. You can run as many strategies as you want on different charts of same market as you want, from same wizard, just changing there names.

Reply With Quote
  #37 (permalink)
systrader
Rocky Mountains
 
Posts: 19 since Jun 2009
Thanks Given: 17
Thanks Received: 37

Kirk,

Up to this point I've only used the built in order handling functions. I have yet to do advanced order handling via IOrder. I have played with ATM strategies a little but nothing earth shattering I'm still in the process of learning the ins/outs of NT (and this forum is a HUGE help).

What KJAVED spoke about sounds interesting as well (eg. pre-configured ATM strategies that a strategy uses). But being a programmer, I will probably end up "coding" my order/profit/stop logic vs. using a pre-configured ATM - but it's nice that NT gives you the ability to do both.

Reply With Quote
Thanked by:
  #38 (permalink)
 
sharky's Avatar
 sharky 
MIAMI,FL
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, tradingview
Broker: Private
Trading: Crypto and natural gas
Posts: 1,063 since Jun 2009
Thanks Given: 625
Thanks Received: 3,906

Sam,peter,sy trader or anyone else

I am interested in testing this strategy Monday for quick scalps, and I would like to revise it to include the following:

I do not want to employ a TrailStop, so set TrailStop default = 0 (not = 1 as it currently is).

I do want an Auto Breakeven feature that once open profit = 2 ticks (set as variable), I want to automatically move my Stop Loss to Entry. This protects my position if my Profit Target is hit but I am not filled, and price then moves against me.

This feature in the ATM Stop Strategy would read as follows:

Auto breakeven (ticks)
Profit trigger: 2 (set as variable) Plus: 0 (set as variable)

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #39 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 477 since Jun 2009
Thanks Given: 1,416
Thanks Received: 404

I've had good success with an ATM strategy that both sets targets and sets stops (even different levels if desired) and then moves the level to breakeven or breakeven + 1tick (to pay for commissions if needed).

SampleAtmStrategy is a built-in script that you could start with if that's the way you're going.

hth

kirk

Reply With Quote
  #40 (permalink)
 
sharky's Avatar
 sharky 
MIAMI,FL
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, tradingview
Broker: Private
Trading: Crypto and natural gas
Posts: 1,063 since Jun 2009
Thanks Given: 625
Thanks Received: 3,906


any one with ideas feel free to make suggestions all ideas will be looked at and if possible we will try anything to make this a really good script...sharky

Visit my NexusFi Trade Journal Started this thread Reply With Quote




Last Updated on November 15, 2009


© 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