NexusFi: Find Your Edge


Home Menu

 





MC / TS : Using Subcharts in studies


Discussion in EasyLanguage Programming

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




 
Search this Thread

MC / TS : Using Subcharts in studies

(login for full post details)
  #1 (permalink)
 NW27 
Newcastle, Australia
 
Experience: Intermediate
Platform: Multicharts 8 - Full Version
Broker: IB
Trading: SPI,FTSE100, 6E, 6A
Posts: 285 since Oct 2010
Thanks Given: 108
Thanks Received: 188

Hi,
How do I use a function that I have coded to work on a Hourly bar in a 5min study?
The issue is that Daily bars do not limit themselves to the session times applied to them.
If I create a chart using hourly bars and set the period to 24hrs and apply the session, I get the bars OHLC that I'm looking for. A daily bar using sessions.
I then want to use this daily OHLC in a function. All good so far. When I do plots on this 24hr chart using my function it gives me the correct signals.
Now I want to use these pseudo daily signals in a 5min chart.

Can I reference a function that is being applied to subchart2 against a study in subchart1?
Or something similar?

Neil.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Request for MACD with option to use different MAs for fa …
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
IQFeed MBO data experience
The Elite Circle
ZigZag displaying ticks
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Supertradersams Thread Journal on NQ/MNQ
28 thanks
GFIs1 1 DAX trade per day journal
25 thanks
Diary of a simple price action trader
13 thanks
Deaddogs Stock Trading
12 thanks
1% Risk Journal
11 thanks

(login for full post details)
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,092



NW27 View Post
Hi,
How do I use a function that I have coded to work on a Hourly bar in a 5min study?
The issue is that Daily bars do not limit themselves to the session times applied to them.
If I create a chart using hourly bars and set the period to 24hrs and apply the session, I get the bars OHLC that I'm looking for. A daily bar using sessions.
I then want to use this daily OHLC in a function. All good so far. When I do plots on this 24hr chart using my function it gives me the correct signals.
Now I want to use these pseudo daily signals in a 5min chart.

Can I reference a function that is being applied to subchart2 against a study in subchart1?
Or something similar?

Neil.

I think you can create your daily OHLC values easily from your 5 minute chart directly. There is no need taking them from the hourly chart.

By the way, it is not clear, what you are trying to achieve and what use you want to make of your daily signals. If you tell us, we might find a solution.

Reply With Quote
(login for full post details)
  #4 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Posts: 50,232 since Jun 2009
Thanks Given: 33,103
Thanks Received: 101,344

It is unclear: Are you asking about TradeStation (you are in the TradeStation section), but your platform in your profile says NinjaTrader.

Can you post your ELD or PLA code?

In general, you simply use data1 to submit orders and data2 (and more, as needed) to hold the dataseries values for the particular timeframe you want (5m, daily, whatever).

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


For the best trading education, watch our webinars
Searching for trading reviews? Review this list


Lifetime Elite Membership: Sign-up for only $149 USD
Receive exclusive 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
The following user says Thank You to Big Mike for this post:
(login for full post details)
  #5 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,092


Big Mike View Post
It is unclear: Are you asking about TradeStation (you are in the TradeStation section), but your platform in your profile says NinjaTrader.

Can you post your ELD or PLA code?

In general, you simply use data1 to submit orders and data2 (and more, as needed) to hold the dataseries values for the particular timeframe you want (5m, daily, whatever).

Mike

Thanks, did not check the thread, just saw NinjaTrader as personal preference for the platform.

Reply With Quote
(login for full post details)
  #6 (permalink)
 NW27 
Newcastle, Australia
 
Experience: Intermediate
Platform: Multicharts 8 - Full Version
Broker: IB
Trading: SPI,FTSE100, 6E, 6A
Posts: 285 since Oct 2010
Thanks Given: 108
Thanks Received: 188

Hi,
On Christmas day I bought MultiCharts. Did I get the Two for One. No :-( Separate story.

In Australia the predominant futures contract is the SPI that trades from 9:50AM to 4:30PM (Day Session) and ~5:30PM to 7:30AM (Night Session)
My first problem is creating Daily bars using the Day Session that I can use in a function and apply to my intraday strategie.
Basically, if the last few days setup in an appropriate manner, then I would go Long the next day.
Sort of using a mix of LBR and Taylor.
So the daily bars give me a direction to trade my 5min bars the next day.

The below code generates a 1=Buy next day at open, -1=sell next day at open, 0=Stand aside.

 
Code
{
    Type - Function
    Name - SW_System1
    Desc - SPI - RSI & ROC 
             This Function is intended for Daily use only
        Returns a Long,Short signal
          Written by Neil Wrightson 

    Version     Date         Reason 
    1        03/01/2011    Start 
}

Variables: YCol(0), XCol(0), ZCol(0), TwopROC(0), LBR_RSI(0), LongTrade(0), ShortTrade(0); 


// External Functions
// ==============================
//
//YCol = return(Max(Ref(Close,-1)-Close,0));
if close[1]-close > 0 then
    YCol = close[1]-close
else
    Ycol = 0 ;
    

//XCol =    return(Max(Close-Ref(Close,-1),0));
if Close-close[1] > 0 then
    XCol = Close-close[1]
else
    Xcol = 0 ;


//ZCol =    return(IIf(Sum(ycol(),3)>0,100-(100/(1+(MA(xcol(),3)/MA(ycol(),3)))),100));
if Summation(YCol,3)>0 then
    zcol = 100-(100/(1+(average(xcol,3)/Average(ycol,3))))
Else
    zcol = 100;



//TwopROC =    return(IIf(Close-Ref(Close,-2)>Max(Ref(Close,-1)-Ref(Close,-3),Ref(Close,-2)-Ref(Close,-4)),1,IIf(Close-Ref(Close,-2)<Min(Ref(Close,-1)-Ref(Close,-3),Ref(Close,-2)-Ref(Close,-4)),-1,0)));
If((Close-Close[2])>iff((Close[1]-Close[3])>(Close[2]-Close[4]),(Close[1]-Close[3]),(Close[2]-Close[4]))) then begin
        TwopROC = 1;
        end
Else begin
    if ((Close-Close[2])<IFF((Close[1]-Close[3])<(Close[2]-Close[4]),(Close[1]-Close[3]),(Close[2]-Close[4]))) then begin
        TwopROC = -1 ;
        end
    Else begin
        TwopROC = 0 ;
    end;
end;

// LBR_RSI =    return(IIf(ZCol()>70,-1,IIf(ZCol()<30,1,0)));
LBR_RSI = IFF(ZCol>70,-1,IFF(ZCol<30,1,0));

// LongTrade =    return(IIf((Ref(LBR_RSI(),-1)>0) AND (Ref(TwopROC(),-1)<1),1,0));
LongTrade =    IFF((LBR_RSI[1]>0) AND (TwopROC[1]<1),1,0);

//ShortTrade = return(IIf((Ref(LBR_RSI(),-1)<0) AND (Ref(TwopROC(),-1)<1) ,1,0));
ShortTrade = IFF((LBR_RSI[1]<0) AND (TwopROC[1]<1) ,1,0);

if Longtrade = 1 then
    SW_System1 = 1 
Else
    if ShortTrade = 1 then
        SW_System1 = -1 
Else
    SW_System1 = 0;
Value1 = GVSetNamedFloat("Setup",SW_System1);
    
    
//print(date:8:0,lbr_rsi,twoproc,xcol,YCol,zcol,SW_System1)
//print(File("C:\SW_System1.TXT"),date:8:0,lbr_rsi,twoproc,xcol,YCol,zcol,SW_System1)
Neil.

Started this thread Reply With Quote
(login for full post details)
  #7 (permalink)
 NW27 
Newcastle, Australia
 
Experience: Intermediate
Platform: Multicharts 8 - Full Version
Broker: IB
Trading: SPI,FTSE100, 6E, 6A
Posts: 285 since Oct 2010
Thanks Given: 108
Thanks Received: 188

Sample chart.
The Top chart is a 5min chart of the SPI only showing the Day session.

The bottom chart is a 24 Hour chart showing Daily bars that represent the Day Session.

Using the function I created, I have plotted Dots at the beginning of the day. Showing Red for Short the day and Green for Long for the day.


Started this thread Reply With Quote
(login for full post details)
  #8 (permalink)
Doctor Leo
St. Petersburg, Russia
 
Posts: 30 since Nov 2010
Thanks Given: 6
Thanks Received: 19

Neil, not sure I have got you properly enough, but have you checked the settings for your instruments in QuoteManager? There are plenty of settings for defining custom trading hours. Then I think you should use not 24h but some other time cycle relevant to the trading hours of your exchange. In this case you will have N-minutes and daily bars exactly corresponding to each other.
Sorry if this sounds dubious, honestly I didn't quite catch the essence of your issue.

Reply With Quote
The following user says Thank You to Doctor Leo for this post:
(login for full post details)
  #9 (permalink)
 NW27 
Newcastle, Australia
 
Experience: Intermediate
Platform: Multicharts 8 - Full Version
Broker: IB
Trading: SPI,FTSE100, 6E, 6A
Posts: 285 since Oct 2010
Thanks Given: 108
Thanks Received: 188

Thanks for responding.
My data feed is via Interactive brokers. From IB you can get the usual tick,minute data and "Daily" bars.
These Daily bars from IB are for a full 24Hr period. IB does not have sessions.

With both NinjaTrader and Multicharts. When you select a "Daily" chart using either NinjaTrader or Multicharts, they use the Daily bars they have down loaded from IB.
Even though they both have Session parameters that can be applied to the Daily chart, they don't use them.
This would mean the application (NinjaTrader and Multicharts) programmers would have to work a little bit harder by looking at the chart and the way the user has set their parameters then
a) See if a session has been applied to it
b) See if the chart is a daily chart
c) if it is a daily chart, build the Daily bars from minute data using the applied session template, not from the daily bars downloaded from IB.

Neil.

Started this thread Reply With Quote
(login for full post details)
  #10 (permalink)
 NW27 
Newcastle, Australia
 
Experience: Intermediate
Platform: Multicharts 8 - Full Version
Broker: IB
Trading: SPI,FTSE100, 6E, 6A
Posts: 285 since Oct 2010
Thanks Given: 108
Thanks Received: 188


No Ideas ???

Started this thread Reply With Quote





Last Updated on January 6, 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