NexusFi: Find Your Edge


Home Menu

 





Custom Strategy with Money Mangement


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
 
fesx's Avatar
 fesx 
Georgia
 
Experience: Intermediate
Platform: Ninja
Broker: AMP/CQG
Trading: ZN, ES, FGBL, FESX
Posts: 134 since Jul 2009
Thanks Given: 897
Thanks Received: 114

Hi,

We're trying to write a strategy that would allow us to use a similar algorithm found in the ATM Strategy but with the ability to backtest on historical data. Writing the code (i.e. C#) is not an issue, what's an issue is understanding how it all should tie in. Here's what I would like to have:

1) If some condition is met then go long. Set some variable to the low and high value to exit. For example -2 ticks to cut our loss and +4 to make a profit.
a) If already long and we reached our profit target we should raise the profit bar and change the loss bar. For example -1 tick for a loss and +2 for a profit.
b) If already long but below or above these limits we should exit the long.

We would have something similar for the short part. The problem we're having is figuring out where to put all this logic (OnBarUpdate or OnExecution) and what methods we should use for enter/exit trades. There are 4 variations only on exiting the long alone (ExitLong, ExitLongLimit, ExitStop, ExitStopLimit). Which one do we need to use?

The way I understand the system so far, we should be able to control the whole process in bar-by-bar. Ideally, from my point of view, we should decide manually when to enter or exit a trade, without relying on the xxxLimit magic

I realize this is all vague, and it's because we're missing many pieces of the puzzle. Any help is appreciated.


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
The Week Ahead -- CPI Wednesday With Oil Past $90, PPI L …
Traders Hideout
$12M Ceasefire Contract Goes Disputed as Bandar Abbas St …
Prediction Markets & Event Contracts
After $87M Settles NO: Irans Nuclear Redline Sets Up the …
Prediction Markets & Event Contracts
NYSE Owner ICE Invests in Crypto Exchange OKX at $25 Bil …
Cryptocurrency
CFTC Approves First US Bitcoin Perpetual Futures -- Kals …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #2 (permalink)
 
sefstrat's Avatar
 sefstrat 
Austin, TX
 
Experience: Advanced
Platform: NT/Matlab
Broker: Interactive Brokers
Trading: FX majors
Posts: 285 since Jun 2009
Thanks Given: 20
Thanks Received: 768

you will want to use the custom IOrder interface to handle this (ie OnOrderUpdate and OnExecution)

See the samples on Ninja forum of how to do the basics with IOrder, but be forewarned its much harder than you would think it should be due to bugs and stupid design decisions in Ninja core.


Reply With Quote




Last Updated on October 5, 2009


© 2026 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 - Downloads - Top
no new posts