back start next[start] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] [49] [ 50 ] [51] [52] [53] [54] 50 If FloatValue > 0.0 Then BeginWhile TcrtalVolume < FloatValue and Bailndex < MaxBarsBack Begin TatalVolume = TotalVolume + Volume[BarIndex]; Bailndex = Barlndex + i; End; End; End;AcmeCetFloatBars = Barlndex;AcmeGetSharesftcneCetShaies: Calculate the number of shares based en risk modelRiskModel = 1. Equal Value Units Model RiskModel = 2, Percent Risk Model RiskModel = 3. Percent Volatility Model **«»,*♦*************♦*****************•+♦*♦*.Inputs:Equity(Nuineric), RiskModel(Numeric). RiskPercent(Numeric), RiskUnits(Numeric);Variables:MinimumShares(200), RiskShares(O), ERP(O.o), Length(20);ERP = Equity * RiskPercent / lOO;If RiskModel - 1 and Close > 0 Then RiskShares = MaxList(MiniinumShares. 100 • IntPortion(Equity / (lOO * Close)));If RiskModel = 2 and RiskUnits > 0 Then RiskShares = MaxList(MiniinumShares, 100 * IntPortion(ERP / (100 * RiskUnits)));If RiskModel = 3 and Volatility(Length) > 0 Then RiskShares MaxList(HinimumShares, 100 * IntPortion(ERP / (100 * Volatility(Length))));AcmeGetShares = RiskShares;AcmeHarami: Search for the extended Harami PatternVariables:RPLimit(0.45), RRLimit(0.60), Haramil(False), Harami2(False). Haramis(False);AcmeHarami = 0;If Range[l] > 0 and Range[2l > 0 and Range[3] > 0 Then Begin Conditionl = Low >= Low[l] and High <= High[l]; Condition2 = Close > Open;Conditions = AcmeRangePercent(Close, l)[l] <= RPLimit andAcmeRangePercent(Open, l)[l] >= (l - RPLimit);Condition4 = (Range / Range[l]} <= RRLimit;Haramil = Conditionl and Condition2 and Conditions andCondition4;Conditionl = Low >= Low[2l and High <= High[2]; Condition2 = Low[l] >= Low[2] and High[l] <= High[2]; Conditions = Close > Open;Condition4 = AcmeRangePercent(Close, l)[2] <= RPLimit and AcmeRangePercent(Open, l)[2l >= (l - RPLimit); Conditions = (Range / Range[2]) <= RRLimit; Harami2 = Conditionl and Condition2 and Conditions and Condition* and Conditions;Conditionl = Low >= Low[3] and High <= High[3]; Condition2 = Low[l] >= Low[3] and High[l] <= H:h[3];Low[2] >= Low[3] and High[2] <= High[3];Conditions Condition4 = Close Conditions Open;it(Close, 1)[3] <= RPLimit andAcmeRangePercent (Open, 1)[ ] >= (l - RPLimit); Condition6 = (Range / Range[3]) <= RRLimit; Haramis = Conditionl and Condition2 and Conditions and Condition4 and Conditions and Condition6;If Haramil or Harami2 or Haramis Then AcmeHarami l;Condition] - Low > Low[l) and High < HIfi; Condilion2 CloM < 0pm;Curalilionl Afin>«.in-PiMnl<()>.-ii. Itmitill......Aii**.nii4-IVM.-nl(l 1..-. , l)l (I Krihiill). f.HHlil mil.] {K.iii,;,- / l) hi.......I.Haramil = Conditioni and Condition2 and Conditions and ConditionA;Conditioni Condition! Conditions Condition4Low >= Low[2] and High <= High[2]; Low[l] >= Low[2] and High[l] <= High[2]; Close < Open;AcmeRangePercent(Open, l)[2] <= RPLimit and AcmeRangePercent(Close. 1)[2] >= (1 - RPLimit); Conditions = (Range / Range[2]) <= RRLimit; Harami2 = Conditioni and Condition! and Conditions and Condition4 and Conditions;Conditioni = Low >= Low[S] and High <= High[3]; Condition2 = Low[l] >= Low[S] and High[l] <= High[s]; Conditions = Low[2] >= Low[S] and High[2] High[s]; Condition4 = Close < Open;Conditions = AcmeRangePercent(Open, l)[S] <= RPLimit and AcmeRangePercent(Close, 1)[S] >= (1 - RPLimit); Condition6 = (Range / Range[S]) <= RRLimit; HaramiS = Conditioni and Condition! and Conditions and ConditionA and Conditions and Condition6;If Haramil or Harami! or HaramiS Then AcmeHarami = !;End;AcmeHighLowlndexFunctionAcmeHighLowlndex: Calculate the High Low IndexInputs:Price(Numeric), Length(Numeric);AcmeHighLowlndex = 0;If Price[l] >= Highest(Price, Length - l)[2] and Price < Price[l] ThenAcmeHighLowlndex = 1 Else If Price[l] <= Lowest(Price, Length - l)[2] and Price > Pricefl] ThenAcmeHighLowlndex = 2;AcmeHook: Search for a Hook PatternInputs:Length(Numeric), Percent(Numeric);AcmeHook = O;If AcmeRetraceUp(Length)[l] and Low < Low[l] andAcmeRangePercent(Close, l) >= (l - Percent) Then AcmeHook = l;If AcmeRetraceDown(Length)[1] and High > High[l] andAcmeRangePercent(Close, 1) <= Percent Then AcmeHook = 2;AcmelnsideDay2FunctionAcmeInsideDay2 = False;If Low > Low[l] and High < High[l] and Low[l] > Low[2] and High[l] < High[2] Then AcmelnsideDay! = True;AcmelnsidePayNR FunctionAcmelnsideDayNR: Find an inside day / narrow range bar4 « « 4-4 « * 4 «!) + * 4 * 4< * * ***** « * >! f *** >! A******* 4-** * * *>44:*44*4-44<44-*4**4444"*444. bar*4«*4t+*«***«X444*JInputs:Rang<.-L<--nKMi(¹im<>iiL), lii
• y(N.imcii. );Aiiiir-lMMili-li.iv¹ l.il-.c-.If Range < Lowest(Range, RangeLength - l)[Index + l] and Low > Low[l] and High < Hihll] Then AcmelnsideDayNR = True;AcmeLogTradesFunctionAcmeLogTrades: Log trades to a file for import into a spreadsheetInputs:LoggingOn(TrueFalse), LogFileName(5tring), SystemlD(String);Variables:ADXLength(14),Length(30).TradeStringC");AcmeLogTrades = False;If LoggingOn and Category = 2 Then Begin{Log Closed Positions}If BarsSinceExit(l) = i Then Begin TradeString = CetSymbolWame + + NufnTo5tr(EntryDate(l), 0) + + NuniToStr(EntryPrice(l), 3) + "," + NuntToStr(ExitDate(l), 0) + + NufnToStr(ExitPrice(l), 3) + "," + NufnToStr(PositionProfit(l), 3) + + NufnTo5tr(ADX(ADXLength)[BarsSinceEntry(l)], 0) + "," + NufnToStr(Volatility(Length)[BarsSinceEntry(l)], 2) + + NunrToStr(AcmeVolatility(Length)fBarsSinceEntiy(l)], 3) + "," + SystemID + NewLine; FileAppend(LogFileName, TradeString);End;{Log Open Positions)If LastBarOnChart and CurrentEntries > 0 Then Begin TradeString = CetSymbolName + + NumToStr(EntryDate(O), 0) + "," + NumToStr(EntryPrice(0), ) + "." + NumToStr (Date, 0) + + NumToStr(Close, 3) + + NumToStr(OpenPositionProfit, 3) + + NumToStr(ADX(ADXLength)[BarsSinceEntry(o)l, O) + "," + NumToStr(Volatility(Length)[Bar5Sincrlrtry(o), 2) "," ♦ N.imTnSlr(A(i4.-Vol.ililily(lrni.th)h.nv4iiui-h(liy(0), 0 i "." 1 .v-hiiiin I Ni-wl ill.-; I ili-Atiii-iiil{hi>;l (lc-ri.inir, h.tili-M i 114,),End;AcmeLogTrades = True; End;AcmeNarrowRangeAcmeNarrowRange: Is the specified bar a narrow range bar?Inputs:RangeLength(Numeric), Index(Numeric);AcmeNarrowRange = False;If Range < Lowest(Range, RangeLength - l)[Index + l] Then AcmeNarrowRange = True;AcmeOnAverageAcmeOnAverage: Is the current bar sitting on the movir average?Inputs:Length(Numeric);Variables: MA(O.O);AcmeOnAverage = False; HA = Average(Close, Length); If HA >= Low and HA <= High Then AcmeOnAverage = True;AcmePullback: Search for a Cann Pullback PatlrtriInfiuK: 11 1 iiril(mii[....... ).hii)-.lh(niim<-rii );[start] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] [49] [ 50 ] [51] [52] [53] [54]