Simple Coding Help - No Promise.

KelvinHand

Well-Known Member
Hello Friends ...

How can i drag banknifty rsi on nifty rsi on nifty chart like we can do it in metastock ???

Such a simple task, just try it out yourself on amibroker . Take less then a minute to find out the answer. It won't burnt your finger.

If you cannot do it by yourself, i doubt PlotForeign you know how to use.

Prove me wrong.
 
Last edited:
Answer is

daysLeft = N - (BarIndex() % N);

Where N is number of days for which bar is being compressed.
Thanks a lot Mastermind, but if i manually check the days left on chart than i got different results from the results given by your afl. what could be the possible reason of this? even once i notice in the chart that a 6 day bar compression was done by 5 days eod data. did this error came from amibroker or it was some kind of data error? and how can it be short out?
Thanks.
 

cellclinic

Well-Known Member
Such a simple task, just try it out yourself on amibroker . Take less then a minute to find out the answer. It won't burnt your finger.

If you cannot do it by yourself, i doubt PlotForeign you know how to use.

Prove me wrong.
Use PlotForeign method
Thanks for your kind reply jee ... I tried to find out in ami but found on price only ... then i tried on google baba & found the following ...
Code:
_SECTION_BEGIN("RSI FORIEGN");
// Internally RSI is implemented as follows
//
function BuiltInRSIEquivalent( period )
{
P = N = 0;

result = Null;

for( i = 1; i < BarCount; i++ )
{
diff = C[ i ] - C[ i - 1 ];
W = S = 0;
if( diff > 0 ) W = diff;
if( diff < 0 ) S = -diff;

P = ( ( period -1 ) * P + W ) / period;
N = ( ( period -1 ) * N + S ) / period;

if( i >= period )
result[ i ] = 100 * P / ( P + N );
}
return result;
}

Plot( BuiltInRSIEquivalent( 14 ), "RSI 1", colorRed );
Plot( RSI( 14 ), "RSI 2", colorBlue );
_SECTION_END();
But still unable to get rsi both for nifty & banknifty :-(

Then tried the following ...

Code:
_SECTION_BEGIN("RSI FORIEGN");
// Internally RSI is implemented as follows
//
function BuiltInRSIEquivalent( period )
{
P = N = 0;

result = Null;

for( i = 1; i < BarCount; i++ )
{
diff = C[ i ] - C[ i - 1 ];
W = S = 0;
if( diff > 0 ) W = diff;
if( diff < 0 ) S = -diff;

P = ( ( period -1 ) * P + W ) / period;
N = ( ( period -1 ) * N + S ) / period;

if( i >= period )
result[ i ] = 100 * P / ( P + N );
}
return result;
}

Plot( BuiltInRSIEquivalent( 14 ), "NIFTY1 RSI 1", colorRed );
Plot( RSI( 14 ), "BANKNIFTY1 RSI 2", colorBlue );
_SECTION_END();


I agree that i am dumb in understanding coding so that asking for a kind help here from friends if possible jee :)

Also it would be a great help if i can change symbols like nifty & banknifty on a single chart & gets buy sell signal when rsi makes cross over jee :)
 

KelvinHand

Well-Known Member
Thanks for your kind reply jee ... I tried to find out in ami but found on price only ... then i tried on google baba & found the following ...

But still unable to get rsi both for nifty & banknifty :-(

Then tried the following ...




I agree that i am dumb in understanding coding so that asking for a kind help here from friends if possible jee :)

Also it would be a great help if i can change symbols like nifty & banknifty on a single chart & gets buy sell signal when rsi makes cross over jee :)
RSI Indicator
PHP:
_SECTION_BEGIN("RSI FOREIGN");
Len = param("Period", 14, 1);
fticker = ParamStr("Foreign Ticker", "Bank Nifty");

// Internally RSI is implemented as follows
Plot( RSIa(Close, Len  ), "RSI", ParamColor("Color-I",colorRed), ParamStyle("Style-I"));


// Foreign Ticker RSI is implemented as follows
Close1 =  Foreign( fticker, "Close" ) ; 
Plot( RSIa(Close1, Len), fticker+".RSI", ParamColor("Color-F",colorBlue), ParamStyle("Style-F", styleOwnScale));

PlotGrid(50, colorGrey50);
PlotGrid(70, colorRed);
PlotGrid(30, colorGreen);
_SECTION_END();
Price ROC Indicator
PHP:
_SECTION_BEGIN("ROC FOREIGN");
Len = param("Period", 12, 1);
fticker = ParamStr("Foreign Ticker", "Bank Nifty");
// Internally is implemented as follows
Plot( ROC( Close, Len ), "ROC", ParamColor("Color-I",colorRed), ParamStyle("Style-I"));

// Foreign Ticker is implemented as follows
Close1 =  Foreign( fticker, "Close" ) ; 
Plot( ROC(Close1, Len), fticker+".ROC", ParamColor("Color-F",colorBlue), ParamStyle("Style-F", styleOwnScale));

PlotGrid(0, colorGrey50);

_SECTION_END();

Momentum Indicator
PHP:
_SECTION_BEGIN("Momentum FOREIGN");
function Momentum(Array, Len)
{
  return  100*Array/Ref(Array, -Len);
}


Len = param("Period", 12, 1);
fticker = ParamStr("Foreign Ticker", "Bank Nifty");
// Internally is implemented as follows
Plot( Momentum( Close, Len ), "Mom", ParamColor("Color-I",colorRed), ParamStyle("Style-I"));

// Foreign Ticker is implemented as follows
Close1 =  Foreign( fticker, "Close" ) ; 
Plot( Momentum(Close1, Len), fticker+".Mom", ParamColor("Color-F",colorBlue), ParamStyle("Style-F", styleOwnScale));

PlotGrid(100, colorGrey50);
_SECTION_END();
Price chart
PHP:
// Internally Price is implemented as follows
Plot( C, "Close", colorBlack, styleNoTitle|styleCandle ); 
  
// Foreign Ticker is implemented as follows  
fticker = ParamStr("Foreign Ticker", "Bank Nifty");

PlotForeign(fticker, fticker, colorBlue, styleline|styleOwnScale);
 
Last edited:

cellclinic

Well-Known Member
Hearlitly Thanks Jeeee for understanding my skills :)

one last one if time permits needed is price oscillator (OSCP ) in same format :clapping:
RSI Indicator
PHP:
_SECTION_BEGIN("RSI FOREIGN");
Len = param("Period", 14, 1);
fticker = ParamStr("Foreign Ticker", "Bank Nifty");

// Internally RSI is implemented as follows
Plot( RSIa(Close, Len  ), "RSI", ParamColor("Color-I",colorRed), ParamStyle("Style-I"));


// Foreign Ticker RSI is implemented as follows
Close1 =  Foreign( fticker, "Close" ) ; 
Plot( RSIa(Close1, Len), fticker+".RSI", ParamColor("Color-F",colorBlue), ParamStyle("Style-F", styleOwnScale));

PlotGrid(50, colorGrey50);
PlotGrid(70, colorRed);
PlotGrid(30, colorGreen);
_SECTION_END();
Price ROC Indicator
PHP:
_SECTION_BEGIN("ROC FOREIGN");
Len = param("Period", 12, 1);
fticker = ParamStr("Foreign Ticker", "Bank Nifty");
// Internally is implemented as follows
Plot( ROC( Close, Len ), "ROC", ParamColor("Color-I",colorRed), ParamStyle("Style-I"));

// Foreign Ticker is implemented as follows
Close1 =  Foreign( fticker, "Close" ) ; 
Plot( ROC(Close1, Len), fticker+".ROC", ParamColor("Color-F",colorBlue), ParamStyle("Style-F", styleOwnScale));

PlotGrid(0, colorGrey50);

_SECTION_END();

Momentum Indicator
PHP:
_SECTION_BEGIN("Momentum FOREIGN");
function Momentum(Array, Len)
{
  return  100*Array/Ref(Array, -Len);
}


Len = param("Period", 12, 1);
fticker = ParamStr("Foreign Ticker", "Bank Nifty");
// Internally is implemented as follows
Plot( Momentum( Close, Len ), "Mom", ParamColor("Color-I",colorRed), ParamStyle("Style-I"));

// Foreign Ticker is implemented as follows
Close1 =  Foreign( fticker, "Close" ) ; 
Plot( Momentum(Close1, Len), fticker+".Mom", ParamColor("Color-F",colorBlue), ParamStyle("Style-F", styleOwnScale));

PlotGrid(100, colorGrey50);
_SECTION_END();
Price chart
PHP:
// Internally Price is implemented as follows
Plot( C, "Close", colorBlack, styleNoTitle|styleCandle ); 
  
// Foreign Ticker is implemented as follows  
fticker = ParamStr("Foreign Ticker", "Bank Nifty");

PlotForeign(fticker, fticker, colorBlue, styleline|styleOwnScale);
 

cellclinic

Well-Known Member
Hello Kelvin Bro ...

Kindly check the pics attached ....

Last averages matching points along with squared areas shuffles when zoomed in & out ...



now check averages in last when zoomed ...



Actual averages values when plotted on NATURALGAS1 Chart



Kindly check averages values which was created by you ...



Kindly help me to get them correct plzzz ...

Momentum basic formula could be the reason & so as others ???



Hearlitly Thanks Jeeee for understanding my skills :)

one last one if time permits needed is price oscillator (OSCP ) in same format :clapping:
 
Last edited:

KelvinHand

Well-Known Member
Hello Kelvin Bro ...

Kindly check the pics attached ....

Last averages matching points along with squared areas shuffles when zoomed in & out ...



now check averages in last when zoomed ...



Actual averages values when plotted on NATURALGAS1 Chart



Kindly check averages values which was created by you ...



Kindly help me to get them correct plzzz ...

Momentum basic formula could be the reason & so as others ???

1. remove the styleOwnScale and try out.

2. Your Momentum on Post #3756 picture is showing 100, I tally with your chart. why you change ?
research http://www.metastock.com/Customer/Resources/TAAZ/Default.aspx?p=72

3. My & your way of momentum functions are correct, up to you to do it. I extract from MT4.

4. ROC & Momentum is the same, but represent in different way
http://www.metastock.com/Customer/Resources/TAAZ/Default.aspx?p=95

5. OSCP is not in your early list, once i done for your request, i will not do for you anymore, but my sample is given. you can follows:
Reference Guide: http://www.metastock.com/Customer/Resources/TAAZ/Default.aspx?p=94

Foreign() required the Price Array, basically OSCP is similar to MACD, compare which Moving Average is using, either MA(C, Period) or EMA(C, Period).

You are not stupid or dumb, you can do it yourself.
 
Last edited:

cellclinic

Well-Known Member
WOWWW ... Almost done & very big thanks & Hip Hip Hurray ti Kelvin Bro :clap:

Last but not the least ;) Momentum values difffers when plotting basic from amibroker ...



& Also needed this last one Dear :)



:thanx:

:hap2:

:cheers:
 

Similar threads