PureBytes Links
Trading Reference Links
|
This is a forwarded message
From: omegatrader@xxxxxxxxxxxx <omegatrader@xxxxxxxxxxxx>
To: "jbclem" <jbclem@xxxxxxxxxxxxx>
Date: Friday, January 03, 2003, 12:36:49 PM
Subject: Convert esignal formula(Bresserts' DSS) into .ela?
===8<==============Original message text===============
Hello jbclem,
here it is:
{Indicator: DSS Bressert }
{*************************************************************}
inputs: pds(10), slw(3), triggerLen(5), overbought(80), oversold(20);
Variables: aa(0), dss(0), trigger(0);
aa = xaverage((close-lowest(low,pds)) / (highest(high,pds) - lowest(low,pds)),slw) *100;
dss =x average((aa-lowest(aa,pds)) / (Highest(aa,pds) -lowest(aa,pds)),slw) *100;
trigger = xaverage(dss, triggerLen);
plot1(dss,"DSS");
plot2(trigger,"Trigger");
plot3(overbought,"OverBought");
plot4(oversold,"OverSold");
{*************************************************************}
OmegaTrader
j> I'd like to ask for some help converting this Double Smoothed Stochastic
j> formula(Bressert) from the eSignal language to easy language(.ela). Here it
j> is in eSignal format:
j> Oscillators > DSS Bressert (Double Smoothed
j> Stochastic) [eSignal EFS Indicators]
j> Download: dss_bressert.efs
j> Category: Indicator > Oscillators
j> Description:
j> Double Smoothed Stochastics (DSS) is
j> designed by William Blaw. It attempts to combine moving average methods with
j> oscillator principles.
j> Inputs:
j> pds - number of bars to calculate trigger
j> slw - number of bars to calculate trigger
j> triggerLen - trigger`s length
j> emalen - number of bars to calculate EMA
j> EFS Code:
j> /*******************************************************************
j> Description : This Indicator plots DSS
j> Bressert
j> Provided By : Developed by TS Support, LLC
j> for eSignal. (c) Copyright 2002
j> ********************************************************************/
j> function preMain()
j> {
j> setStudyTitle("DSS Bressert");
j> setCursorLabelName("DSS", 0);
j> setCursorLabelName("Trigger", 1);
j> setDefaultBarFgColor(Color.brown, 0);
j> setDefaultBarFgColor(Color.red, 1);
j> addBand(20, PS_SOLID, 1, Color.black);
j> addBand(80, PS_SOLID, 1, Color.black);
j> }
j> var EMA_1 = 0;
j> var EMA1_1 = 0;
j> var EMA2_1 = 0;
j> vAA = new Array();
j> function main(pds,slw,triggerLen,emalen){
j> if (pds == null)
j> pds = 10;
j> if (slw == null)
j> slw = 3;
j> if (triggerLen == null)
j> triggerLen = 5;
j> if (emalen == null)
j> emalen = 9;
j> var vHigh = getValue("High",0,-pds);
j> var vLow = getValue("Low",0,-pds);
j> var dClose = getValue("Close");
j> var K = 2 / (emalen + 1);
j> var K2 = 2 / (triggerLen + 1);
j> var aa = 0;
j> var dss = 0;
j> var High = 0;
j> var Low = getValue("Low");
j> var aHigh = 0;
j> var aLow = 10000000;
j> var EMA1 = 0;
j> var EMA = 0;
j> for (i = 0; i < pds; i++){
j> if (High < vHigh[i])
j> High = vHigh[i];
j> if (Low > vLow[i])
j> Low = vLow[i];
j> }
j> if((High - Low) != 0)
j> EMA = K * ( (dClose - Low) / (High -
j> Low) ) + (1 - K) * EMA_1;
j> else
j> EMA = EMA_1;
j> if (getBarState() == BARSTATE_NEWBAR)
j> EMA_1 = EMA;
j> aa = EMA * 100;
j> for(i = pds - 1; i > 0; i--)
j> vAA[i] = vAA[i - 1];
j> vAA[0] = aa;
j> for (i = 0; i < pds; i++){
j> if (aHigh < vAA[i])
j> aHigh = vAA[i];
j> if (aLow > vAA[i])
j> aLow = vAA[i];
j> }
j> if (aHigh - aLow != 0)
j> EMA1 = K * ( (aa - aLow) / (aHigh -
j> aLow) ) + (1 - K) * EMA1_1;
j> else
j> EMA1 = EMA1_1;
j> if (getBarState() == BARSTATE_NEWBAR)
j> EMA1_1 = EMA1;
j> dss = EMA1 * 100;
j> var EMA2 = K2 * dss + (1 - K2) * EMA2_1;
j> if (getBarState() == BARSTATE_NEWBAR)
j> EMA2_1 = EMA2;
j> return new Array(dss,EMA2);
j> }
j> /*******************************************************************/
j> John
--
Best regards,
omegatrader mailto:omegatrader@xxxxxxxxxxxx
===8<===========End of original message text===========
--
Best regards,
omegatrader mailto:omegatrader@xxxxxxxxxxxx
|