NexusFi: Find Your Edge


Home Menu

 





One Trade Per Bar NINJASCRIPT


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one LastShadowRider with 5 posts (0 thanks)
    2. looks_two RJay with 2 posts (2 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 MWinfrey with 1 posts (1 thanks)
    1. trending_up 3,572 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 8 posts
    2. attach_file 1 attachments




 
Search this Thread

One Trade Per Bar NINJASCRIPT

  #1 (permalink)
 
LastShadowRider's Avatar
 LastShadowRider 
Las Vegas
 
Experience: Intermediate
Platform: NT7
Broker: Mirus/Zen-Fire
Trading: es tf
Posts: 13 since Apr 2010
Thanks Given: 18
Thanks Received: 2

I need to code my strategy so that it wil stop taking more than one trade per bar. I am using onbar update, because of the nature of the entry level (on a pull back of 10 ticks from the high of the bar that is painting). The strategy enters the trade and hits the target. Then it re-enters the trade, when the entry condition exhists again on the same bar. How can I stop this from happening, without using the calculate on bar close function?

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Quant vue
Trading Reviews and Vendors
Trade idea based off three indicators.
Traders Hideout
What broker to use for trading palladium futures
Commodities
Better Renko Gaps
The Elite Circle
How to apply profiles
Traders Hideout
 
  #3 (permalink)
 
RJay's Avatar
 RJay 
Hartford, CT. USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: RTY
Posts: 683 since Jun 2009
Thanks Given: 758
Thanks Received: 787



LastShadowRider View Post
I need to code my strategy so that it wil stop taking more than one trade per bar. I am using onbar update, because of the nature of the entry level (on a pull back of 10 ticks from the high of the bar that is painting). The strategy enters the trade and hits the target. Then it re-enters the trade, when the entry condition exhists again on the same bar. How can I stop this from happening, without using the calculate on bar close function?

When the order is placed, set a bool condition at the same time that prevents additional orders.

Reset bool condition to accept new orders on new bar or first tick of bar.

Reply With Quote
Thanked by:
  #4 (permalink)
 
MWinfrey's Avatar
 MWinfrey 
Lubbock TX
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Stage 5 Trading
Trading: CL
Posts: 1,878 since Jul 2009
Thanks Given: 1,450
Thanks Received: 3,335


LastShadowRider View Post
I need to code my strategy so that it wil stop taking more than one trade per bar. I am using onbar update, because of the nature of the entry level (on a pull back of 10 ticks from the high of the bar that is painting). The strategy enters the trade and hits the target. Then it re-enters the trade, when the entry condition exhists again on the same bar. How can I stop this from happening, without using the calculate on bar close function?

you can check to make sure the strategy is flat before entering.

place this in your code where you test for entry conditions.

Position.MarketPosition == MarketPosition.Flat

Reply With Quote
Thanked by:
  #5 (permalink)
 
LastShadowRider's Avatar
 LastShadowRider 
Las Vegas
 
Experience: Intermediate
Platform: NT7
Broker: Mirus/Zen-Fire
Trading: es tf
Posts: 13 since Apr 2010
Thanks Given: 18
Thanks Received: 2

I have found something that works somewhat, but I think there is a better solution. I have a variable that changes when ever I enter a trade. That variable will not be zero againg until the bar ends. This seems to work most of the time. Sometimes the market moves so fast that the variable is reset to zero and at the same time the trade re-triggers. I am getting close. Any thoughts on how to fix this. I am using range bars and the variable resets to zero if I hit the top or the bottom of the range bar. Is there a string that checks to see if this is a new bar? Then I can tell the strategy to reset the variable to zero if a New bar is painting. Once again Thank you for your input.

Started this thread Reply With Quote
  #6 (permalink)
 
LastShadowRider's Avatar
 LastShadowRider 
Las Vegas
 
Experience: Intermediate
Platform: NT7
Broker: Mirus/Zen-Fire
Trading: es tf
Posts: 13 since Apr 2010
Thanks Given: 18
Thanks Received: 2

RJay Can you send me the Code for the bool Solution?

Started this thread Reply With Quote
  #7 (permalink)
 
RJay's Avatar
 RJay 
Hartford, CT. USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: RTY
Posts: 683 since Jun 2009
Thanks Given: 758
Thanks Received: 787


LastShadowRider View Post
RJay Can you send me the Code for the bool Solution?

Try this....

Attached Files
Elite Membership required to download: test55.cs
Reply With Quote
Thanked by:
  #8 (permalink)
 
LastShadowRider's Avatar
 LastShadowRider 
Las Vegas
 
Experience: Intermediate
Platform: NT7
Broker: Mirus/Zen-Fire
Trading: es tf
Posts: 13 since Apr 2010
Thanks Given: 18
Thanks Received: 2

Rjay I saw some of the charts on your website. Which one is the most popular?

Started this thread Reply With Quote
  #9 (permalink)
 
LastShadowRider's Avatar
 LastShadowRider 
Las Vegas
 
Experience: Intermediate
Platform: NT7
Broker: Mirus/Zen-Fire
Trading: es tf
Posts: 13 since Apr 2010
Thanks Given: 18
Thanks Received: 2

RJay thanks again for the Boolean no trade this bar test. It works like a charm

Started this thread Reply With Quote




Last Updated on August 2, 2011


© 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