Last active
December 29, 2016 18:14
-
-
Save axelrivera/b4e83973d4beb6cc57e3b0a8c94364cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_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 ) ) )); | |
upColor = ParamColor("Up Color", colorBlack); | |
downColor = ParamColor("Down Color", colorRed); | |
Plot(C, "Close", IIf(C >= Ref(C, -1), upColor, downColor), styleBar); | |
shortMAColor = ParamColor("Short MA Color", colorGreen); | |
shortMAPeriod = Null; | |
mediumMAColor = ParamColor("Medium MA Color", colorRed); | |
mediumMAPerdiod = Null; | |
longMAColor = ParamColor("Long MA Color", colorBlack); | |
longMAPeriod = Null; | |
switch (Interval()) { | |
case inDaily: | |
shortMAPeriod = 20; | |
mediumMAPeriod = 50; | |
longMAPeriod = 200; | |
break; | |
case inWeekly: | |
mediumMAPeriod = 10; | |
longMAPeriod = 40; | |
break; | |
case inMonthly: | |
mediumMAPeriod = 10; | |
longMAPeriod = 20; | |
break; | |
} | |
if (!IsNull(shortMAPeriod)) { | |
Plot(MA(C, shortMAPeriod), "SMA(" + shortMAPeriod + ")", shortMAColor, styleLine); | |
} | |
if (!IsNull(mediumMAPeriod)) { | |
Plot(MA(C, mediumMAPeriod), "SMA(" + mediumMAPeriod + ")", mediumMAColor, styleLine); | |
} | |
if (!IsNull(longMAPeriod)) { | |
Plot(MA(C, longMAPeriod), "SMA(" + longMAPeriod + ")", longMAColor, styleLine); | |
} | |
_SECTION_END(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_SECTION_BEGIN("Volume"); | |
upColor = ParamColor("Up Color", colorBlack); | |
downColor = ParamColor("Down Color", colorRed); | |
Plot(Volume, _DEFAULT_NAME(), IIf(C >= Ref(C, -1), upColor, downColor), styleHistogram | styleThick); | |
averageVolumeColor = ParamColor("Average Volume Color", colorRed); | |
requiredVolumeColor = ParamColor("Required Breakout Volume Color", colorBlue); | |
volumePeriod = Null; | |
volumeRequired = Null; | |
showRequired = False; | |
switch (Interval()) { | |
case inDaily: | |
volumePeriod = 50; | |
showRequired = True; | |
break; | |
case inWeekly: | |
case inMonthly: | |
volumePeriod = 10; | |
break; | |
} | |
if (!IsNull(volumePeriod)) { | |
volumeAverage = MA(Volume, volumePeriod); | |
Plot(volumeAverage, "SMA(" + volumePeriod + ")", averageVolumeColor, styleLine); | |
} | |
if (showRequired) { | |
volumeRequired = volumeAverage * 1.5; | |
Plot(volumeRequired, "Required Breakout Volume", requiredVolumeColor, styleLine); | |
} | |
_SECTION_END(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Relative Volume Percent.afl> | |
_SECTION_BEGIN("Relative Volume"); | |
upColor = ParamColor("Up Color", colorBlack); | |
downColor = ParamColor("Down Color", colorRed); | |
volumeColor = ParamColor("Color", colorBlack); | |
requiredColor = ParamColor("Required Breakout Volume Color", colorBlue); | |
period = Null; | |
switch (Interval()) { | |
case inDaily: | |
period = 50; | |
break; | |
case inWeekly: | |
case inMonthly: | |
period = 10; | |
break; | |
} | |
if (!IsNull(period)) { | |
Plot(RelativeVolumePercent(period), "Relative Volume %", IIf(C >= Ref(C, -1), upColor, downColor), styleHistogram | styleThick); | |
Plot(0, "", colorBlack, styleLine); | |
Plot(50, "", requiredColor, styleLine); | |
} | |
_SECTION_END(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment