/*_____________________________________________________________________________ ** function name: scramble ** descriptions: ** Scramble the input 32bits value. ** ** parameters: ** None ** ** global: ** None ** ** return: ** After Scramble the value ** ** call: ** reverseLong ** ** revision: ** 1. Here 2008/08/24 **____________________________________________________________________________ */ static uint32 scramble(uint32 checkCode) { uint32 a[6]; a[1] = (checkCode & 0x0000001F) << 0x0C; a[2] = (checkCode & 0x03E003E0) << 0x01; a[3] = (checkCode & 0xF8000400) >> 0x0A; a[4] = (checkCode & 0x0000F800) << 0x10; a[5] = (checkCode & 0x041F0000) >> 0x0F; checkCode = a[1] + a[2] + a[3] + a[4] + a[5]; /* ICQ's check code is little-endian. Change the endian style */ checkCode = reverseLong(checkCode); return checkCode; }/*end scramble*/
function run() { BarPeriod = 1440; //Detrend = 8; // does it also work with the inverse curve? asset("SPX500"); vars Osc = series(StochEhlers(series(price()),20,10,10)); if(crossOver(Osc,0.8)) reverseShort(1); if(crossUnder(Osc,0.2)) reverseLong(1); PlotWidth = 800; plot("StochEhlers",Osc[0],NEW,RED); plot("Threshold1",.2,0,BLACK); plot("Threshold2",.8,0,BLACK); set(PLOTNOW); }