Multi-Timeframe in a strategy - NinjaTrader Programming | futures io social day trading
futures io futures trading


Multi-Timeframe in a strategy
Updated: Views / Replies:8,568 / 30
Created: by max-td Attachments:0

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 
Thread Tools Search this Thread
 

Multi-Timeframe in a strategy

  #1 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received

Multi-Timeframe in a strategy

Hi,
i try to use following idea from caprica that i found really interesting :

In the Initialize section add the line

Add(PeriodType.Range, 1)

Using range 1 instead of tick 1 is much more efficient and will still manage the trade every 1 tick of price movement. Helpful for trailing stops or etc.


my idea is :
to cancel a limitorder if i get no fill and the price is running away.

i have a strategy that is working OK.
now i add
Add(PeriodType.Range, 1) In the Initialize section -- a basic thing.

now i found out that i have to use if (BarsInProgress == 0)
at the biginning to keep my strategy in the basic timeframe for checking the entryconditions.

Once my limit-order is in the market, i want to use the second timeframe (1 Range) to manage the order-canceling if needed.

i tried different ways - also with if (BarsInProgress == 1) or Highs[1] [0] to have a switch to the 1 Range timeframe --- with no sucsess.

samething i am doing wrong.

any tips / ideas to that ?


if
(

create==1 // means Limit-Order is in the market

&&

valueClose +5 <= Highs[1] [0]

// ( valueClose +5 = the last Barclose+5 ticks of the main timeframe )
//( Highs[1] [0] should represent the High of the 1-Range-timeframe)


)

{
AtmStrategyCancelEntryOrder(entryorderid);

}

max-td
Reply With Quote
 
  #2 (permalink)
Elite Member
USA
 
Futures Experience: Master
Platform: NinjaTrader
 
caprica's Avatar
 
Posts: 155 since Jul 2009
Thanks: 45 given, 109 received


max-td View Post
Hi,
i try to use following idea from caprica that i found really interesting :

In the Initialize section add the line

Add(PeriodType.Range, 1)

Using range 1 instead of tick 1 is much more efficient and will still manage the trade every 1 tick of price movement. Helpful for trailing stops or etc.


my idea is :
to cancel a limitorder if i get no fill and the price is running away.

i have a strategy that is working OK.
now i add
Add(PeriodType.Range, 1) In the Initialize section -- a basic thing.

now i found out that i have to use if (BarsInProgress == 0)
at the biginning to keep my strategy in the basic timeframe for checking the entryconditions.

Once my limit-order is in the market, i want to use the second timeframe (1 Range) to manage the order-canceling if needed.

i tried different ways - also with if (BarsInProgress == 1) or Highs[1] [0] to have a switch to the 1 Range timeframe --- with no sucsess.

samething i am doing wrong.

any tips / ideas to that ?


if
(

create==1 // means Limit-Order is in the market

&&

valueClose +5 <= Highs[1] [0]

// ( valueClose +5 = the last Barclose+5 ticks of the main timeframe )
//( Highs[1] [0] should represent the High of the 1-Range-timeframe)


)

{
AtmStrategyCancelEntryOrder(entryorderid);

}

If you use any BarsSinceEntry() or BarsSinceExit() anywhere in your script at all, you must rewrite them to make them MTF compatible. Change to BarsSinceEntry(0, "long", 0) to indicate barsarray 0, signal name "long", last entry.

If you aren't using that and still having trouble... Highs[1][0] would represent barsarray 1 bar 0 (last bar). You are right.

Also on your order submission, you can submit it to a smaller time frame:
EnterLong(1, 3, "long");

This will submit to bars array 1, order quantity 3, for long. Submitting to smaller time frame is useful for limit order because ninja will cancel the limit order at the end of the bar if not filled so keep in mind this and size of time frame.

As for cancelling an order manually, sorry I can not help. I do not use limit orders because of all the extra bugs in ninja to deal with them in backtesting.

"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

Reply With Quote
 
  #3 (permalink)
Elite Member
USA
 
Futures Experience: Master
Platform: NinjaTrader
 
caprica's Avatar
 
Posts: 155 since Jul 2009
Thanks: 45 given, 109 received


Also remember your other indicator based signals to need changing such as

double ma = EMA(BarsArray[1], 21)[0];

You can do the if (BarsInProgress == 1) method as well, but remember that if you check a dataseries value for a BarsArray other than current it will be zero/null. For instance if you .Set a dataseries in array 1 and check it in array 0, sometimes it will be zero/null.

I prefer to set the dataseries in all time frames and call it using the BarsArray[x] method so the dataseries is never 0/null.

so I am pointing all of this out because I do not know if your script in general is not MTF compatbile until you make all these changes or if everything is fine except you cant cancel the order.

"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

Reply With Quote
 
  #4 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received

well ... there is nothing special inside the strategy ---- just some simple conditions and a call for an Entry via ATM-creation :


if (blabla )


{
AtmStrategyCreate(Action.Buy, OrderType.Limit, valueClose - 1 , 0,
TimeInForce.Day, entryorderid, atmname,
atmorderid);
create = 1;
}

dont know could cause MTF- troubles here -- but never used MTF before i must say.

max-td
Reply With Quote
 
  #5 (permalink)
Elite Member
USA
 
Futures Experience: Master
Platform: NinjaTrader
 
caprica's Avatar
 
Posts: 155 since Jul 2009
Thanks: 45 given, 109 received


max-td View Post
well ... there is nothing special inside the strategy ---- just some simple conditions and a call for an Entry via ATM-creation :


if (blabla )


{
AtmStrategyCreate(Action.Buy, OrderType.Limit, valueClose - 1 , 0,
TimeInForce.Day, entryorderid, atmname,
atmorderid);
create = 1;
}

Turn on TraceOrders and check the log to see if something obvious is appearing there.

"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

Reply With Quote
 
  #6 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received

the strategy is working -- order is starting -- ATM runs fine -- all OK
also nothing in the logs...

only the cancel-function doesnt work

max-td
Reply With Quote
 
  #7 (permalink)
Elite Member
USA
 
Futures Experience: Master
Platform: NinjaTrader
 
caprica's Avatar
 
Posts: 155 since Jul 2009
Thanks: 45 given, 109 received


max-td View Post
the strategy is working -- order is starting -- ATM runs fine -- all OK
also nothing in the logs...

only the cancel-function doesnt work

You have TraceOrders on and output window open? The cancel order works fine in a non-MTF?

"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

Reply With Quote
 
  #8 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received

what do you mean by : TraceOrders on and output window open?


The cancel order works fine in a non-MTF? if i use a non-MTF-condition - the cancel-logic works.

max-td
Reply With Quote
 
  #9 (permalink)
Elite Member
USA
 
Futures Experience: Master
Platform: NinjaTrader
 
caprica's Avatar
 
Posts: 155 since Jul 2009
Thanks: 45 given, 109 received


max-td View Post
what do you mean by : TraceOrders on and output window open?


The cancel order works fine in a non-MTF? if i use a non-MTF-condition - the cancel-logic works.

 
Code
                            
In Initialize()


TraceOrders true
Open the Output Window, Tools -> Output Window.

"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

Reply With Quote
 
  #10 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received


k - did that ... -- clear outputs for me....

init
start
entryorderid= 78fe3748de0f4f70b441ca3ae9b5c4ca
atmorderid= a711fb5193ff4c4ba3448538c8fd5141
atmname= zuni29
------------------------------------------------1
state=start
start
entryorderid= 3a8d7a5c771a460e9098874afd42be51
atmorderid= ed486e8224744fd293ba15fce757c972
atmname= zuni29

max-td
Reply With Quote

Reply



futures io > > > > > Multi-Timeframe in a strategy

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
HOW TO DO A SIMPLE MULTI-TIMEFRAME SCREEN IN MARKET SCANNER ShruggedAtlas MultiCharts 13 December 19th, 2014 12:04 PM
Multi Timeframe Price Indicator michaelf NinjaTrader 1 March 17th, 2011 01:07 PM
Multi Timeframe EMA indicator kulu NinjaTrader Programming 3 November 14th, 2010 06:10 PM
sensitivity multi-timeframe trick (small timeframe on bigger one) SARdynamite NinjaTrader Programming 4 July 15th, 2010 03:57 PM
Ninja Strategy multi-timeframe issue/Strategy to indicator nw123 NinjaTrader Programming 2 December 20th, 2009 07:24 PM


All times are GMT -4. The time now is 12:35 AM.

Copyright © 2017 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
Page generated 2017-12-11 in 0.14 seconds with 19 queries on phoenix via your IP 107.20.115.174