NexusFi: Find Your Edge


Home Menu

 





Convert MQ4 to Ninjatrader


Discussion in NinjaTrader

Updated
    1. trending_up 5,078 views
    2. thumb_up 15 thanks given
    3. group 3 followers
    1. forum 14 posts
    2. attach_file 8 attachments




 
Search this Thread

Convert MQ4 to Ninjatrader

  #1 (permalink)
 Realtimetrader 
Overijssel
 
Experience: Master
Platform: Ninja
Trading: FDAX
Posts: 15 since Aug 2010
Thanks Given: 4
Thanks Received: 2

I need help tot convert a MQ4 indicator tot Ninjatrader format.

Thanks for helping me:

//+------------------------------------------------------------------+
//| Chande_Kroll_Stop_v1.mq4 |
//| Copyright © 2006, Forex-TSD.com |
//| Written by IgorAD,[email protected] |
//| http://finance.groups.yahoo.com/group/TrendLaboratory |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Forex-TSD.com "
#property link "http://www.forex-tsd.com/"
//----
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//---- input parameters
extern int Length =20;
extern int ATRPeriod =10;
extern double Kv =3;
//---- indicator buffers
double UpTrend[];
double DnTrend[];
double smin[];
double smax[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- indicator line
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
IndicatorBuffers(4);
SetIndexBuffer(0,UpTrend);
SetIndexBuffer(1,DnTrend);
SetIndexBuffer(2,smin);
SetIndexBuffer(3,smax);
//---- name for DataWindow and indicator subwindow label
short_name="Chande Kroll Stop("+Length+","+ATRPeriod+","+Kv+")";
IndicatorShortName(short_name);
SetIndexLabel(0,"UpTrend");
SetIndexLabel(1,"DnTrend");
//----
SetIndexDrawBegin(0,Length);
SetIndexDrawBegin(1,Length);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Chande_Kroll_Stop_v1 |
//+------------------------------------------------------------------+
int start()
{
int shift,limit, counted_bars=IndicatorCounted();
//----
if(counted_bars > 0) limit=Bars-counted_bars;
if(counted_bars < 0) return(0);
if(counted_bars ==0) limit=Bars-Length-1;
//----
for(shift=limit;shift>=0;shift--)
{
smin[shift]=High[Highest(NULL,0,MODE_HIGH,ATRPeriod,shift)] - Kv*iATR(NULL,0,ATRPeriod,shift);
smax[shift]=Low [Lowest (NULL,0,MODE_LOW ,ATRPeriod,shift)] + Kv*iATR(NULL,0,ATRPeriod,shift);
//
UpTrend[shift]=-10000000;
DnTrend[shift]= 10000000;
//----
for(int i=Length-1;i>=0;i--)
{
UpTrend[shift]=MathMax( UpTrend[shift], smin[shift+i]);
DnTrend[shift]=MathMin( DnTrend[shift], smax[shift+i]);
}
}
return(0);
}
//+------------------------------------------------------------------+

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
Cheap historycal L1 data for stocks
Stocks and ETFs
NexusFi Journal Challenge - May 2024
Feedback and Announcements
Trade idea based off three indicators.
Traders Hideout
How to apply profiles
Traders Hideout
 
  #2 (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,234
Thanks Received: 101,655

You are likely to have better luck posting in the "Want your NT indicator created free" thread:



But you need to include at least a couple charts, so people can reference them.

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
  #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,103


I had a quick look at the formula and then produced a first version for NinjaTrader.

The chart is shown below.

Could you please compare it to a MetaTrader chart in order to confirm that it looks right?

If it is correct, I will finish the indicator and publish it in the downloads.



Reply With Quote
Thanked by:
  #4 (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,103

The Chandelier Stop is based on a similar concept.

However, it does not require a lookback period for determining the highest high and lowest low, as it uses the highest high since the last trend change.

The chart below shows a comparison between the Chande-Kroll Stop and the Chandelier Stop (which was used by systems trader Charles LeBeau and has nothing to do with Tushar Chande).



Reply With Quote
Thanked by:
  #5 (permalink)
 Realtimetrader 
Overijssel
 
Experience: Master
Platform: Ninja
Trading: FDAX
Posts: 15 since Aug 2010
Thanks Given: 4
Thanks Received: 2

Hi Fat Tails,

Yes this looks greath. 100% Perfect.

Thanks for helping the code converting.

Chade kroll stop are a very good indicator. I could find it for Ninjatrader.

Thanks again.

Martien

Started this thread Reply With Quote
  #6 (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,103


Realtimetrader View Post
Hi Fat Tails,

Yes this looks greath. 100% Perfect.

Thanks for helping the code converting.

Chade kroll stop are a very good indicator. I could find it for Ninjatrader.

Thanks again.

Martien


If you found it, was the ATR calculation based on a SMA of the true range (as Chande & Kroll) or was it based on an exponential moving average (classic or Wilder)?

Reply With Quote
  #7 (permalink)
 Realtimetrader 
Overijssel
 
Experience: Master
Platform: Ninja
Trading: FDAX
Posts: 15 since Aug 2010
Thanks Given: 4
Thanks Received: 2


Fat Tails View Post
If you found it, was the ATR calculation based on a SMA of the true range (as Chande & Kroll) or was it based on an exponential moving average (classic or Wilder)?


I've used in the past ProRealTime. In that program are the Chande Kroll Stop indicator.

https://www.prorealtime.com/en/

I can not give 100% certainty answer your question. What I do know is that the lines of this Chande Kroll Stop sometimes suddenly comes to lie above or below the rates. This is often a signal for a trend change. I have often thought that this indicator ProRealTime volume was related.

You can take a free subscription (day close dates) on ProRealTime to see the version of this Chande Kroll Stop.

I will send you a screenshot of it (Prorealtime)

Send you later.

Started this thread Reply With Quote
  #8 (permalink)
 Realtimetrader 
Overijssel
 
Experience: Master
Platform: Ninja
Trading: FDAX
Posts: 15 since Aug 2010
Thanks Given: 4
Thanks Received: 2


Realtimetrader View Post
I've used in the past ProRealTime. In that program are the Chande Kroll Stop indicator.

https://www.prorealtime.com/en/

I can not give 100% certainty answer your question. What I do know is that the lines of this Chande Kroll Stop sometimes suddenly comes to lie above or below the rates. This is often a signal for a trend change. I have often thought that this indicator ProRealTime volume was related.

You can take a free subscription (day close dates) on ProRealTime to see the version of this Chande Kroll Stop.

I will send you a screenshot of it (Prorealtime)

Send you later.



Started this thread Reply With Quote
  #9 (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,103

The NinjaTrader chart looks similar. I will finish the indicator and post it.


Reply With Quote
  #10 (permalink)
 Realtimetrader 
Overijssel
 
Experience: Master
Platform: Ninja
Trading: FDAX
Posts: 15 since Aug 2010
Thanks Given: 4
Thanks Received: 2



Fat Tails View Post
The NinjaTrader chart looks similar. I will finish the indicator and post it.


Oke thanks for progam this indicator. I am with this !!!!

Greatings,

Martien

Started this thread Reply With Quote




Last Updated on October 14, 2015


© 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