QooQ 發表於 13-1-17 17:33

請教前輩程式print問題

站上前輩,請教一下, 在HTS上寫策略時, 程式中有一個 print的的指令; 因剛接觸AB 不知AB程式語法中,是不是也有相同指令可以使用; 下面的樣本,若用AB應該怎麼寫, 煩請站上前輩可否指導指導; 感謝感謝~

1. value1 = H+L+C/2
2. value2 = MA5
3. value3 = MA10
4. 當價格穿越 MA10買進(箭號)
5. 當價格跌破 MA5賣出(箭號)

6. print value1
7. print value2
8. print value3

QooQ 發表於 13-1-21 21:53

不知沒有會的人可以教一下... 感激不盡!!

kilroy 發表於 13-1-22 00:48

QooQ 發表於 13-1-21 21:53 static/image/common/back.gif
不知沒有會的人可以教一下... 感激不盡!!

* 小弟來幫一下大大好了


barcomplete = BarIndex() < LastValue(BarIndex());

_SECTION_BEGIN("Background_Setting");
SetChartBkColor(1);
SetChartOptions(2,chartShowArrows|chartShowDates|chartWrapTitle);
SetChartBkGradientFill(1, 1, 1);
GraphXSpace = Param("Zoom/In Out",100,-50,150,1);
dist = 2*ATR(15);
_SECTION_END();

SetPositionSize(1, spsShares);
SetOption("InitialEquity", 1000000);
SetOption("FuturesMode", 1);
SetOption("CommissionMode", 3);
SetOption("CommissionAmount", 1000);
RoundLotSize = 1;
PointValue = 200;


Buy = Cross( (H+L+C)/3, MA(C,10) ) AND barcomplete;
Short = Cross( MA(C,5), (H+L+C)/3 ) AND barcomplete;

Buy = Cover = ExRem(Buy, Short);
Short = Sell = ExRem(Short, Buy);

BuyPrice = CoverPrice = C;
ShortPrice = SellPrice = C;

Position = IIf(Buy, 1, IIf(Short, -1, 0));
CurrentPosition = ValueWhen(Position!=0, Position, 1);
IsCPNull = IsNull(CurrentPosition);

MarketPosition = IIf(Cum(Buy+Short)==0, 0, IIf(IsCPNull!=1, IIf(CurrentPosition==1, 1, -1), 0));

_SECTION_BEGIN("Charts");
PlotOHLC( O, H, L, C, "", IIf(MarketPosition == 0, 0, IIf(MarketPosition>0, colorRed, colorGreen)), styleBar|styleNoLabel);
PlotShapes(IIf(Buy, 59, shapeNone), 7, 0, WMA(O,10)-dist, 6);
PlotShapes(IIf(Short, 60, shapeNone), 7, 0, WMA(O,10)+dist, 0);
_SECTION_END();



---
HTS 裡的 print

在 AB 裡是 printf

參考看看吧

QooQ 發表於 13-1-22 20:41

kilroy前輩 謝謝~
{:4_153:}
頁: [1]
查看完整版本: 請教前輩程式print問題