File Name: Simplify.efs
Description:
Simplify It by James E. Rich and John B. Rich
Formula Parameters:
Simplify.efs
ArrowUP: Blue
ArrowDOWN: Red
Notes:
The related article is copyrighted material. If you are not a subscriber
of Stocks & Commodities, please visit www.traders.com.
Download File:
Simplify.efs
Simplify.efs
EFS Code:
Description:
Simplify It by James E. Rich and John B. Rich
Formula Parameters:
Simplify.efs
ArrowUP: Blue
ArrowDOWN: Red
Notes:
The related article is copyrighted material. If you are not a subscriber
of Stocks & Commodities, please visit www.traders.com.
Download File:
Simplify.efs
Simplify.efs
EFS Code:
PHP Code:
/*********************************
Provided By:
Interactive Data Corporation (Copyright ?© 2015)
All rights reserved. This sample eSignal Formula Script (EFS)
is for educational purposes only. Interactive Data Corporation
reserves the right to modify and overwrite this EFS file with
each new release.
Description:
Simplify by James E. Rich and John B. Rich
Formula Parameters: Default:
ArrowUP Blue
ArrowDOWN Red
Version: 1.00 11/06/2015
Notes:
The related article is copyrighted material. If you are not a subscriber
of Stocks & Commodities, please visit www.traders.com.
**********************************/
var fpArray = new Array();
function preMain(){
setStudyTitle("Simplify");
setPriceStudy(true);
setCursorLabelName("50MA", 0);
setCursorLabelName("8MA-High", 1);
setCursorLabelName("8MA-Low", 2);
setDefaultBarFgColor(Color.green, 0);
setDefaultBarFgColor(Color.blue, 1);
setDefaultBarFgColor(Color.red, 2);
setDefaultBarThickness(2, 0);
setDefaultBarThickness(1, 1);
setDefaultBarThickness(1, 2);
var x = 0;
fpArray[x] = new FunctionParameter("ArrowUP", FunctionParameter.COLOR);
with(fpArray[x++]){
setDefault(Color.blue);
}
fpArray[x] = new FunctionParameter("ArrowDOWN", FunctionParameter.COLOR);
with(fpArray[x++]){
setDefault(Color.red);
}
}
var bVersion = null;
var xMA50 = null;
var xMA8H = null;
var xMA8L = null;
var xClose = null;
var nTrend = 0;
var nTrend_1 = 0;
var nBarCounter = 0;
function main(ArrowUP, ArrowDOWN){
if (bVersion == null)
bVersion = verify();
if (bVersion == false)
return;
if(getBarState() == BARSTATE_ALLBARS){
nTrend = 0;
nTrend_1 = 0;
xMA50 = sma(50);
xMA8H = sma(8, high());
xMA8L = sma(8, low());
xClose = close();
}
var nMA50 = xMA50.getValue(0);
var nMA8H = xMA8H.getValue(0);
var nMA8L = xMA8L.getValue(0);
var nClose = xClose.getValue(0);
if (nMA50 == null || nMA8H == null || nMA8L == null || nClose == null )
return;
if(getBarState() == BARSTATE_NEWBAR){
nTrend_1 = nTrend;
nBarCounter = getCurrentBarCount();
}
if(nTrend_1 == 0){
if(nClose > nMA8H){
nTrend_1 = 1;
drawShape(Shape.UPARROW, BelowBar2, ArrowUP, "UP"+nBarCounter);
}
if(nClose < nMA8L){
nTrend_1 = -1;
drawShape(Shape.DOWNARROW, AboveBar2, ArrowDOWN, "DN"+nBarCounter);
}
}
if(nTrend_1 != 1){
if(nClose > nMA8H){
drawShape(Shape.UPARROW, BelowBar2, ArrowUP, "UP"+nBarCounter);
nTrend = 1;
}else{
removeShape("UP"+nBarCounter);
nTrend = nTrend_1;
}
}
if(nTrend_1 != -1){
if(nClose < nMA8L){
drawShape(Shape.DOWNARROW, AboveBar2, ArrowDOWN, "DN"+nBarCounter);
nTrend = -1;
}else{
removeShape("DN"+nBarCounter);
nTrend = nTrend_1;
}
}
return [nMA50, nMA8H, nMA8L];
}
function verify(){
var b = false;
if (getBuildNumber() < 3742){
drawTextAbsolute(5, 35, "This study requires version 12.1 or later.",
Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
null, 13, "error");
drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp",
Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
null, 13, "upgrade");
return b;
}
else
b = true;
return b;
}