Convert gregorian date to hijri date

how to add hijri date beside gregorian date

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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

thank you

hi Mr. Tomasz

Is it possible to add the Hijri date with the Gregorian date?

Hello needhelp,

if there is any function missing in your mind not yet implemented by AFL you are "at start" to build your own function. I understand you want to "calculate the age of the moon in any given day" with a small probability of a one-day error for any calculation to convert a date. There are samples searching by Google in other script languages like visual basic so it should be possible for you to convert/translate to AFL.

Sample:

https://www.c-sharpcorner.com/UploadFile/a80666/convert-date-from-solar-gregorian-to-lunar-hijri-using-v/

You are the man, so do it, if your code does not work, post your problem, perhaps somebody will comment, but please dont simple ask other people to do the work for you.

Best regards,
Peter

1 Like

Hello Pietro
my reply only to say Hello

you know just to add the date Lunar beside date Gregorian in AB chart.

but the story behind Lunar date and using it in the market it is different story.
I will talk about it if I have a chance.

when I ask the question ?
i asked the owner of Amibroker .
is it possible to add Lunar date on the chart .

just some issues left for me and I will be fine .

if you have more then 5 indicators in you trading strategy that mean you have big problem in the trading.

https://www.mail-archive.com/search?l=amibroker@yahoogroups.com&q=subject:%22%5C%5Bamibroker%5C%5D+Re%5C%3A+Moon+Phases%22&o=newest&f=1

this the code

// Downloaded From https://.............................................com
_SECTION_BEGIN("Lunar cycle");
// Input your local time zone
TZ=Param("Your local Time Zone? [-12 to +12hrs]",2, -12,12,1);

// Lunar cycle
LunarMonth=29.530589;
Offset=7.254621;

// Calendar }
leap=frac(Year( )/4)==0 AND frac(Year()/ 100)!=0 OR frac(Year()/ 400)==0;
y=Year()*365+ int(Year( )/4)-int( Year()/100) +int(Year( )/400);
m=
IIf(Month()==2,31-leap,
IIf(Month()==3,59,
IIf(Month()==4,90,
IIf(Month()==5,120,
IIf(Month()==6,151,
IIf(Month()==7,181,
IIf(Month()==8,212,
IIf(Month()==9,243,
IIf(Month()==10,273,
IIf(Month()==11,304,
IIf(Month()==12,334, -leap))))))) ))));
CurrentDay=y+ m+Day()-TZ/ 24-Offset;

// Full Moon }
FM=frac(CurrentDay/ LunarMonth) ;
FM=PeakBars( FM, 1, 1)==0;

// New Moon }
NM=frac((CurrentDay +LunarMonth/ 2)/LunarMonth) ;
NM=PeakBars( NM, 1,1)==0;
FullMoon=FM-NM==1;
NewMoon=FM-NM==-1;

//Plot Moon Phase in own window }

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() ); 

SetChartBkGradientFill( ParamColor("BgTop", colorWhite),ParamColor("BgBottom", colorLightYellow));

shape = IIf(FullMoon,shapeCircle+shapePositionAbove,IIf(NewMoon,shapeCircle+shapePositionAbove,Null));

PlotShapes(shape,IIf(FullMoon,colorYellow,colorBlack),0,H);
_SECTION_END();

but it is not quite right

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.