NexusFi: Find Your Edge


Home Menu

 





how do i create this strategy?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one kaywai with 5 posts (0 thanks)
    2. looks_two sam028 with 3 posts (0 thanks)
    3. looks_3 max-td with 2 posts (0 thanks)
    4. looks_4 Big Mike with 1 posts (0 thanks)
    1. trending_up 3,912 views
    2. thumb_up 0 thanks given
    3. group 4 followers
    1. forum 9 posts
    2. attach_file 1 attachments




 
Search this Thread

how do i create this strategy?

  #1 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7

Hi,

Need some help trying to create this strategy.

1) To determine the high and low of the first 30 mins of trading day and to use them as the day's support and resistance.
2) To initiate a long if a higher high is greater than the high that was determined in the first 30 minutes and to initiate a short if a lower low is lesser than the low that was determined first 30 mins of the trading day.

i can't get the high and low of the first 30 minutes to be the boundaries for use throughout the day. by that i mean, the high and low keeps on moving as we move through the trading day. and i am using 1 minute charts.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NexusFi Journal Challenge - May 2024
Feedback and Announcements
How to apply profiles
Traders Hideout
Cheap historycal L1 data for stocks
Stocks and ETFs
MC PL editor upgrade
MultiCharts
Quant vue
Trading Reviews and Vendors
 
  #2 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927

hallo kaywai,
welcome to our forum !

max-td
Reply With Quote
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


Maybe something like:
 
Code
                            
private int endPeriod 100000;
private 
int _H;
private 
int _L;
protected 
override void OnBarUpdate()
{
if (
ToTime(Time[0]) < endPeriod
  return;
if (
ToTime(Time[0]) == endPeriod) {
  
_H=HighestBar(HighBars.BarsSinceSession 1);
  
_L=LowestBar(LowBars.BarsSinceSession 1);}
  return;
if (
High High[_H])
  
EnterLongDefaultQuantity,"");
if (
Low Low[_L])
  
EnterShortDefaultQuantity,"");
  

_H/_L stores the bar number which had the higher high/lower low before 10:00 am (I assume we are here working on the ES cash session, in NY timezone, and the start session is defined at 09:30 am)

Not tested...

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #4 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7

Sam, Thx for your help. Getting an "error on generating strategy message, and being a noob at programming doesn't help! Let me show you what I've done and you can point out what I've done wrong.

{
#region
privateint endPeriod = 081500;
privateint _H;
privateint _L;
#endregion
}
protectedoverridevoid OnBarUpdate()
{
if (ToTime(Time[0]) < endPeriod)
return;
if (ToTime(Time[0]) == endPeriod) {
_H=HighestBar(High, Bars.BarsSinceSession -
1);
_L=LowestBar(Low, Bars.BarsSinceSession -
1);}
return;
if (High > High[_H])
EnterLong(_H + TickSize);
if (Low < Low[_L])
EnterShort(_L - TickSize);
}

Reply With Quote
  #5 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7

Thanks for the welcome Max. Hopefully one day I can contribute. Right now, I'm a noob!

Reply With Quote
  #6 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629

You may create a basic strategy with the wizard, then edit the .cs an make your own modification.
If you had removed the space char between private and int, for example, well it's not going to work...



Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #7 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7

sorry dude. thx again

Reply With Quote
  #8 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7

Hi Jeff, Try this

Attached Files
Elite Membership required to download: CTOD.zip
Reply With Quote
  #9 (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,460 since Jun 2009
Thanks Given: 33,233
Thanks Received: 101,647


sam028 View Post
You may create a basic strategy with the wizard, then edit the .cs an make your own modification.
If you had removed the space char between private and int, for example, well it's not going to work...



This is just from pasting into the forum, you need to wrap code around either the [ code ] or [ php ] blocks so it doesn't word wrap or improperly format.

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
  #10 (permalink)
 
IBLAB's Avatar
 IBLAB 
Wilmington ,NC ,United States
 
Experience: Master
Platform: Sierra
Trading: futures
Posts: 29 since May 2014
Thanks Given: 135
Thanks Received: 12



Big Mike View Post
This is just from pasting into the forum, you need to wrap code around either the [ code ] or [ php ] blocks so it doesn't word wrap or improperly format.

Mike

Thanks BIG MIKE. I WISH I knew how to code. U r work is fabulous. Tyvvm. IB

Sent from my SM-G950U using Tapatalk

Reply With Quote




Last Updated on August 20, 2018


© 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