Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - kelvinhand

Pages: [1] 2
1
Code: [Select]
function sMM(xx) {
return WriteIf(xx==1,"Jan",WriteIf(xx==2,"Feb",WriteIf(xx==3,"Mar",WriteIf(xx==4,"Apr",WriteIf(xx==5,"May",WriteIf(xx==6,"Jun",WriteIf(xx==7,"Jul",WriteIf(xx==8,"Aug", 
WriteIf(xx==9,"Sep",WriteIf(xx==10,"Oct",WriteIf(xx==11,"Nov",WriteIf(xx==12,"Dec", ""))))))))))));
}

function sDate( nDate ) {
   xx = nDate/10000; yy = int(xx); xx -=yy; yy+=1900; xx *=100; mm = int(xx); xx -= mm; xx *=100; dd = int(xx); return ""+yy+"-"+mm+"-"+dd;
}

function sDate2( nDate ) {
   xx = nDate/10000;    yy = int(xx);   xx -=yy;    yy+=1900;    xx *=100;       mm = int(xx);    xx -= mm;      xx *=100;   dd = int(xx);
   return ""+yy+"-"+sMM(mm)+"-"+dd;
}

xx = sDate(1011231); 
_TRACE(" xx = " + xx);

xx = sDate2(970205); 
_TRACE(" xx = " + xx);

2
MACDhistogram= MACD() – Signal() ;
Buy=Cross(C,MA(High,10)) AND MACDhistogram > 0;
Sell=Cross(MA(Low,10),C) AND MACDhistogram < 0 ;
PlotShapes(IIf(Sell==1, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-15);
PlotShapes(IIf(Buy==1, shapeUpArrow , shapeNone), colorGreen, 0,Low, Offset=-15);

this will not give desired result the signal should plot on when both of MA & MACD histogram value higher

please help me on this

Code: [Select]
MACDhistogram= MACD() - Signal() ;
mah = MA(High,10);
mal = MA(low,10);

Buy= BarsSince(MACDhistogram > 0)==0 AND Cross(C,mah);
Sell=BarsSince(MACDhistogram < 0)==0 AND Cross(mal,c);


Plot(MA(High,10), "", colorYellow);
Plot(MA(Low,10), "", colorYellow);

PlotShapes(IIf(Sell, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-15);
PlotShapes(IIf(Buy, shapeUpArrow , shapeNone), colorLime, 0,Low, Offset=-15);

3
Amibroker Help / Re: Help required on 3-13-34 EMA crossover AFL
« on: September 29, 2015, 06:38:12 am »
hi,

Here below I have 3EMA crossover 8EMA AFL.

Requesting one of you to please edit/modify this to 3EMA / 13 EMA / 34 EMA AFL.

Thanks much in anticipation!

Code: [Select]
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
 
 [php]
_SECTION_BEGIN("ema_crossover");
x = EMA(Close,3);
y = EMA(Close,8);
Plot(EMA(Close,3),"",colorRed,styleLine);
Plot(EMA(Close,8),"",colorDarkGreen,styleLine);
 
Buy=Cross(x,y);
PlotShapes(shapeUpArrow*Buy,colorGreen);
XR=(EMA(Close,3) * (2 / 6 - 1) - EMA(Close,8) * (2 / 11 - 1)) / (2 / 6 - 2 / 11);
Title = Name() + " " + Date()+" " + EncodeColor( colorBlue ) +"3/8 EMA " +EncodeColor( colorRed )
+ " O " + O + " H " + H + " L " + L + " C "+ C + "\n";
 
Sell=Cross(y,x);
PlotShapes(shapeDownArrow*Sell,colorRed);
AlertIf( Sell, "SOUND C:\\Windows\\Media\\chord.wav", "Audio alert", 2 );
XR=(EMA(Close,8) * (2 / 6 - 1) - EMA(Close,3) * (2 / 11 - 1)) / (2 / 6 - 2 / 11);
Title = Name() + " " + Date()+" " + EncodeColor( colorBlue ) +"3/8 EMA " +EncodeColor( colorRed )
+ " O " + O + " H " + H + " L " + L + " C "+ C + "\n";
 
_SECTION_END();

Code: [Select]
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
 
 
_SECTION_BEGIN("ema_crossover");
len1 = 3;
len2 = 13;
len3 = 34;
ma1 = EMA(Close,len1);
ma2 = EMA(Close,len2);
ma3 = EMA(Close,len3);

Plot(ma1, "EMA"+len1,ColorYellow,styleLine, Null, Null, 0, 1);
Plot(ma2, "EMA"+len2,colorGreen,styleLine, Null, Null, 0, 1);
Plot(ma3, "EMA"+len3,colorAqua,styleLine, Null, Null, 0, 1);

Buy=MA2>Ma3 AND Cross(ma1, ma2);
Sell=MA3>Ma2 AND Cross(ma2, ma1);


PlotShapes(Buy * shapeUpArrow + Sell * shapeDownArrow,
IIf( Buy, colorGreen, colorRed ), 0,
IIf( Buy, Low, High ) );



PlotShapes(shapeDownArrow*Sell,colorRed,0, H);

//AlertIf( Sell, "SOUND C:\\Windows\\Media\\chord.wav", "Audio alert", 2 );
 
_SECTION_END();

4
Amibroker Help / Re: Need help how to calculate zig-zag
« on: September 29, 2015, 05:54:58 am »
i didn't understand  the value from zig-zag function in amibroker .Need someone to explain how to calculate the value  from this function

http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:zigzag

5
Trading System Discussion / Re: Ichimoku Chart range
« on: July 02, 2015, 06:46:26 am »
Hello,

I just started working with the Ichimoku Charts and really like them.

The question I have is which range should be used. I found other site that suggest to use 18,52,104 instead of the original 9,18,52 range.  Have anyone done any studies to which range works better and why?

Thnx

Most Book refer 9,26,52. Use that.

6
Amibroker Help / Re: TimeNum () strategy
« on: June 11, 2015, 01:22:56 am »
Hi,

here is a super simple strategy I'm trying to work out.

Buy = timenum()== 93000 && Close[0] > Close[1] ;
Sell = timenum()== 93000 && Close[0] < Close[1] ;

However in the present state it doesnt work.
Anyone has an idea what's wrong/ how to fix it?

Thank you

Jim

I think should be this way:
Buy = timenum()== 93000 and Close > ref(Close, -1) ;
Sell = timenum()== 93000 and Close < ref(Close, -1) ;

7
Amibroker Help / Re: Simple color question
« on: June 11, 2015, 01:18:21 am »
I've created a custom AFL which as edited version of "Price (all in one)". However I can't get the colors to change. I've changed the value for the short MA to be ParamColor( "Color", colorAqua ) but it's still defaulting to display the previous value which was ParamColor( "Color", colorCycle )

Either goto the Parameter to reset all OR
Kill the existing chart and insert the new modified one.

8
Amibroker Help / Re: Newbie Question on MA of RSI
« on: June 11, 2015, 01:15:12 am »
Hi All,

I'm new here....I know this is very simple, but I seem to be stuck, what is the easiest way to code a 3 period MA to RSI(14) ?

Any insight would be greatly appreciated.

Joe

ma1 = ma(rsi(14), 3);

9
Suppose I have a symbol DAS.G and EFS.XF. I would like to remove the substring after the dot (including dot itself) so that the output becomes DAS and EFS respectively.

How can this be done in AFL?


//--  Testing Purpose, for actual replace with Name();

sName =  "DAS.G";
pos = strfind(sName, ".");
str = strleft(sName, pos-1);

printf(str);  // Check interpretation window

10
Amibroker Help / Re: why some symbols do not have any trade ?
« on: October 06, 2013, 07:17:40 pm »
Hi

Some symbols is not coming in the explorer and in the backtesting do not show any trade but when I look to the chart
There are a lot of trades . Any body know why ?

Because your explorer and backtesting got the Filtering ability, but your eye don't have.

11
Amibroker Help / Re: Syntax Error
« on: September 29, 2013, 09:44:36 pm »
Kevin,
 Thank you sorry for the incomplete coding but what you provided worked like a charm

It was nothing.
PercentRank() was (i think) inbuild in Ver 5.60 onward.
And the function given to you was described in the help guide.



12
Amibroker Help / Re: Syntax Error
« on: September 29, 2013, 10:34:57 am »
Would someone please tell me why  this is returning a syntax error
Amibroker Version 5.2

 crsi = ( PercentRank (ROC(C,1), lenROC) + RSIa(updownDays,lenUD) + RSI(lenRSI))/3;

thanks

How can any expert to tell you the reasoning of the above such short  statement without the information of the error listing.
You should also list out your full code.
I believe you are trying below code.
Code: [Select]
//Connor's RSI (Larry Connors).  Code for function provided by Connors Research

paramLenRSI = Param("RSI Closes Length", 3, 2, 100, 1);
paramLenUD = Param("RSI UpClose Length", 2, 2, 100, 1);
paramLenRank = Param("PerecentRank Length", 100, 10, 200, 1);

function ConnorsRSI(lenRSI, lenUD, lenROC)
{
      upDays = BarsSince(C <= Ref(C,-1));
      downDays = BarsSince(C >= Ref(C,-1));
      updownDays = IIf(upDays > 0, upDays, IIf(downDays > 0, -downDays, 0));
      crsi = ( PercentRank(ROC(C,1), lenROC) + RSIa(updownDays,lenUD) +
RSI(lenRSI))/3;
      return crsi;
}

Plot( ConnorsRSI(paramLenRSI,paramLenUD,paramLenRank)
      , "ConnorsRSI("+paramLenRSI+","+paramLenUD+","+paramLenRank+")"
      , colorBlue, styleLine, 0, 100);


However, based on my experience, I suspect your Version 5.2, did not had the function PercentRank().

If no, then copy and paste the following function into your code before apply of PercentRank()
Code: [Select]
function PercentRank( Data, Periods)
{
   Count = 0;
  for ( i = 1; i <= Periods ; i++ )
   {
   Count += Data > Ref( Data, -i );
   }
  return 100 * Count / Periods;
}




13
Amibroker Chat / Re: I want to help
« on: September 21, 2013, 08:40:49 pm »
This equation





_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
_SECTION_BEGIN("C?? C???CI?CE");
strength = Param("Strength",1,1,15,1);
prR=PeakBars(H,strength)==0;
psS =TroughBars(L,strength)==0;
rRf=ValueWhen(prR,H);
sSf=ValueWhen(psS,L);
Plot(rRf,"",colorGreen,styleDots,styleNoLabel);
Plot(sSf,"",colorRed,styleDots,styleNoLabel);
_SECTION_END();
_SECTION_END();


I want to add some condition which
Relating to the time Balavasl

If the price broke the resistance puts a green arrow mark provided that the penetration on the weekly interval

Code: [Select]
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("Weekly Sup/Res");
strength = Param("Strength",1,1,15,1);

TimeFrameSet(inWeekly);
 
prR=PeakBars(H,strength)==0;
psS =TroughBars(L,strength)==0;

rRf=ValueWhen(prR,H);
sSf=ValueWhen(psS,L);
TimeFrameRestore();


wrrf = TimeFrameExpand(rRf, inWeekly);
wssf = TimeFrameExpand(sSf, inWeekly);

Plot(wrrf,"",colorGreen,styleDots,styleNoLabel);
Plot(wssf,"",colorRed,styleDots,styleNoLabel);


Buy=Cross(H, wrrf);
Sell=Cross(wssf, L);

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;

PlotShapes( shape, IIf( Buy, colorLime, ColorRGB(255,0, 255) ), 0, IIf( Buy, Low, High) );


_SECTION_END();

14
Amibroker Chat / Re: RSI
« on: September 08, 2013, 10:55:48 pm »
I am looking for code for change of parameters with change of chart TF.

If chart is daily,weekly monthly I want RSI(14) on chart.

If chart is any TF (60,56,51, 28,14 or any other),I want RSI(9) on chart.

At present I have to change parameters whenever I change from daily to intra to daily.

In short I need code for a smart RSI which will adjust itself according to TF of chart.


Period 
IIf (Interval()>=inDaily149);
Plot(RSI(Period), "RSI("+Period+")"colorRed);

15
Amibroker Help / Re: How to debug Amibroker's program (AFL)
« on: September 08, 2013, 10:12:00 pm »
Use the _TRACE() function to log messages to the internal Log Trace Window or DbgView to debug the AFL

Pages: [1] 2