pine-script - 将 Amibroker 脚本转换为 pine 脚本
问题描述
是否可以将此 amibroker 脚本转换为 pinescript。如果有人可以帮助我开始,我会做剩下的,特别是关于 TZ 和 peakbars。这是月球周期图
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);
解决方案
推荐阅读
- python - 错误:命令 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' 失败,退出状态为 1158
- javascript - 在 Angular 8 中的另一个应用程序中引用服务代码
- android - (导航组件)返回首页fragment时如何在activity上显示返回箭头?
- asp.net-core - ASP.NET Core Application Insights - 跟踪经过身份验证的用户 ID
- javascript - 触发模态确认时Formik丢失字段
- linux - 用户输入与 .txt 的比较
- c++ - 如何在 OpenSceneGraph 中缩放/旋转/移动资产
- android - 我的代码丢失了,有没有办法找回它?
- python - Cutout2D 不以星系为中心
- mysql - 如何在 C# 应用程序中使用 MySQL 连接器/NET