NEED HELP TO WRITE MY FIRST STRATEGY - futures io
futures io futures trading



NEED HELP TO WRITE MY FIRST STRATEGY


Discussion in NinjaTrader

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




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

NEED HELP TO WRITE MY FIRST STRATEGY

(login for full post details)
  #1 (permalink)
Brussels Belgium
 
Experience: Beginner
Platform: Ninjatrader
Broker: GAINCAPITAL/Forex.com
Trading: Forex
 
Posts: 14 since Mar 2013
Thanks: 5 given, 0 received

Hello to you

I can manipulate my edit script by now

But I'm nowhere, let's be honnest. There are so many commands that you would save me time indicating me whitch set of command I could Start with for my first «own scrpit*»

I read a lot in the forum but didn't find what I want or maybe came accross without noticing that was the command Iwas looking for.

I will give and example I think this is the best way

I intend working this way

protected override void Initialize()
{

CalculateOnBarClose = False;
}

I'm not interested in bars closed though I know it is CPU intensive

I have the EURJPY a 120,55

I will write this example for a long entry but the logic would be the same if I would go short

As I enable my strategy, I want this 120,55 value stored in a «*double*» variable

(This is my first problem, I have been unable to find a way for doing so)


Let's say The EURJPY moves up 1 pip up to 120,56

At time I want to start a stop watch to 0 second


First case

The EURJPY moves up 4 more pips to 120,60 within 3 seconds, I would enter long

Second Case

3 seconds have elapsed and the EURJPY moved up to 120,59

It didn't fill my condtions to enter long and the stop watch resets to Zero

Third Case

The EURJPY went up to 120,58 and then back down to 120,57. Well, it didn't fill my conditions either

But....

It might be a new begining of a short entry process

I went down one pip, didn't he*?

I now want the 120,58 stored in my double Variable and restart a stop wath to Zero

And If the EURJPY moved down within 3 second I enter Short.

TO REPHASE THIS IN SHORT

1. How to I do To get the Actual Value of the EURJPY in a variable as I start my strategy.
2. How do I start a stop watch

Thanks in advance



Benwinckelmans

Started this thread Reply With Quote

Journal Challenge February 2021 results (so far):
Competing for $1500 in prizes from Topstep
looks_oneSBtrader82 's Trading Journalby SBtrader82
(167 thanks from 31 posts)
looks_twoJust BEING a Trader: Letting Go!!by iqgod
(116 thanks from 33 posts)
looks_3Wisdom is Emptinessby Mtype
(68 thanks from 25 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(31 thanks from 17 posts)
looks_5Journal for peanuts1956by peanuts1956
(23 thanks from 13 posts)
 
 
(login for full post details)
  #3 (permalink)
NC, USA
 
Experience: None
Platform: None Yet
Trading: Guitar
 
MrYou's Avatar
 
Posts: 403 since Jun 2011
Thanks: 618 given, 196 received


My suggestion is to forget about this "stop watch" stuff. You need to understand how charts and NinjaScript work. I can't explain it all, but below is some simple code.

Add() a 3 second chart or base your primary bars (BarsInProgress == 0) off the 3 second chart.

CalculateOnBarClose = true;

 
Code
if (BarsInProgress == 0)
{
   if (Close[0] - Open[0] > TickSize * 3)
     EnterLong();
}
OR for Multi-Timeframe: Add(PeriodType.Second, 3)

 
Code
if (Closes[1][0] - Opens[1][0] > TickSize * 3)
  EnterLong();

Reply With Quote
The following user says Thank You to MrYou for this post:


futures io Trading Community Platforms and Indicators NinjaTrader > NEED HELP TO WRITE MY FIRST STRATEGY


Last Updated on April 2, 2013


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Journal Challenge w/$1500 prizes from Topstep!

February
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Call Option Buying: The New Pain Trade? w/Carley Garner

Elite only
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts