NexusFi: Find Your Edge


Home Menu

 





help with automated strategy


Discussion in NinjaTrader

Updated
    1. trending_up 1,325 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread

help with automated strategy

  #1 (permalink)
maggtrading
quintana roo, méxico
 
Posts: 84 since Mar 2013
Thanks Given: 222
Thanks Received: 40

hello everyone,


because nt is free and because it has superior order management capabilities to other platforms i have been trying to code some simple ideas as automated strategies.


however, i have run into some unsolvable issues with variables, functions, properties and nt limitations. therefore i could use some help in coding what must be a very simple strategy for people who know what they are doing.


i would greatly appreciate if i can get help in coding a simple strategy that made trades following bollinger's bands:

if price (0) >= bollinger's upper band
enter long

if price (0) <= upper band
exit all long positions

if price (0) <= lower band
enter short

if price (0) <= lower band
exit all short positions


what i am having the most issues with is being able to have nt compare price (0) to the upper / lower bands (error message says operand can't be applied). also, i haven't been able to figure out how to define the equations used for the upper / middle / lower bands (which require elementary arithmetic operations) so that nt can then use them (as doubles? as data series? other?).



thanks a lot, regards.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
How to apply profiles
Traders Hideout
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
19 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
  #2 (permalink)
maggtrading
quintana roo, méxico
 
Posts: 84 since Mar 2013
Thanks Given: 222
Thanks Received: 40

@NTDeveloper



man, thanks a lot. the code you provided works perfectly and does just what was requested.




i still could use some help with the strategy i'm trying to put together. if i wanted to define two lines of my own (longline, shortline) how could i define a couple of lines that performed the following operations and what kind of properties should they have so that nt can apply the same operands (>, <, =) between these lines and the price on close?


let's say the inputs for the bollinger bands were not hard coded into the strategy but were left as input variables so that they could be optimized: longperiod, longconstant, shortperiod and shortconstant.


the lines would then be:


longline = sma (longperiod) + ( longconstant * stdv (longperiod))

shortline = sma (shortperiod ) - ( shortconstant* stdv (shortperiod ))


i haven't been able to get this kind of adjustable bollinger bands to work on nt, not by defining them as double variables, nor integers nor data sets. it must be some very basic mistake i keep making, but i hope someone with a lot more experience coding on nt can help me get past this obstacle.

Reply With Quote




Last Updated on March 30, 2016


© 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