NexusFi: Find Your Edge


Home Menu

 





Strategy to open only 1 trade


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one peter88 with 4 posts (0 thanks)
    2. looks_two sam028 with 2 posts (6 thanks)
    3. looks_3 Big Mike with 1 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 4,946 views
    2. thumb_up 7 thanks given
    3. group 2 followers
    1. forum 7 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 peter88 
toronto
 
Experience: Intermediate
Platform: NinjaTrader
Broker: forex.com
Trading: forex
Posts: 32 since Aug 2009
Thanks Given: 28
Thanks Received: 6

I am new to programimg and I am looking for idea how to make the strategy execute 1 trade only and then close down. for the next trade trader needs to start Strategy again . Later on I woould like to add choice of entry "Number of lots, direction to trade...". This could be more partially-automated Strategy. Hopefully we can change indicators inside and test indicators.
If somebody knows simillar Strategy ,please let me know.

thanks
peter88


Started this thread Reply With Quote

 
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Administrator
 
Posts: 3,779 since Jun 2009
Thanks Given: 3,840
Thanks Received: 4,709


This is very easy:
- define a boolean variable
 
Code
                            
#region variables
bool trade_already_done = false;
#endregion 
- before the trade, check this value, and when your first trade is take, change it:
 
Code
                            
protected override void OnBarUpdate() {
if (
Historical==false)  // if we want it to works on realtime data only
  
return;
if (
trade_already_done==true) // the strategy has already took a trade, so let it sleep
  
return;
if (
Close[0]>Close[1] {
  
EnterLong();
  
trade_already_done=true;
  }
if (
Close[0]<Close[1] {
  
EnterShort();
  
trade_already_done=true;
  }
} 
Not tested at all, but that's the idea.


Success requires no deodorant! (Sun Tzu)
Reply With Quote
  #4 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 R.I.P. 1977-2026 
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,599

Don't forget to reset it each day, I think you can check Bars.SessionBreak()

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 X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #5 (permalink)
 peter88 
toronto
 
Experience: Intermediate
Platform: NinjaTrader
Broker: forex.com
Trading: forex
Posts: 32 since Aug 2009
Thanks Given: 28
Thanks Received: 6

Thanks Big Mike and sam028. Its very incouraging to see replays. I am learning and studying and once I have basic "General Strategy" running I put it here for further development. I started with idea to create "General Strategy" which can handle 1 to x lots with money management similar to ATM in Ninja.

It needs Sl, TP, TS for every lot independent. I think I start with 1 lot. Doing it myself because I want to understand exactly how it works. Any reasonable indicator should be easilly plug in and this way we can test for good signal indicator or indicators.

For any indicator: First step in testing indexes,oil is to have 1 lot tested with basic TP=4ticks and SL=x. If we cannot reach 50% of trades 4ticks at the beginning I think we dont have good entry signal. I see that udjusting parameters can improve profitability in backtest. But we need to start with good signal in the first place.

I am using Big Mike Strategy which he created in his video.His Excellent video made me started.

thanks again
peter88


Started this thread Reply With Quote
  #6 (permalink)
 
sam028's Avatar
 sam028 
Site Administrator
 
Posts: 3,779 since Jun 2009
Thanks Given: 3,840
Thanks Received: 4,709

If you want to create a generic strategy, take @MWinfrey's one, you can find it here.
He has made a very good job with this strategy, you have all you need in it, and it's also a very good way to understand how it works.


Success requires no deodorant! (Sun Tzu)
Reply With Quote
Thanked by:
  #7 (permalink)
 peter88 
toronto
 
Experience: Intermediate
Platform: NinjaTrader
Broker: forex.com
Trading: forex
Posts: 32 since Aug 2009
Thanks Given: 28
Thanks Received: 6

Thanks Sam028,

You are very helpfull. I downloaded General strategy and will try to learn from it .

thanks
peter88


Started this thread Reply With Quote
  #8 (permalink)
 peter88 
toronto
 
Experience: Intermediate
Platform: NinjaTrader
Broker: forex.com
Trading: forex
Posts: 32 since Aug 2009
Thanks Given: 28
Thanks Received: 6

Hi ,

I will continue discussion about this subjest at new thread; Strategy SEMI AUTOMATED.



thanks
peter88


Started this thread Reply With Quote




Last Updated on January 25, 2011


© 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