PDA

View Full Version : MIDAS Tradestation Code



lulzasaur
08-18-2011, 12:30 PM
Hey guys,

I was trying to look for the Tradestation code for Levine's MIDAS curve. However, for most of the ready-made indicators that I came across, the formula appeared to be incorrect. After researching further, I came up with my own ts code and am happy to share it with these forums. Any feedback is welcomed, as this is my first foray into coding. Many thanks to EB, as I used his vwap band code as a template.

code:
{************************************************* **********************************************

Coded by lulzasaur

************************************************** *********************************************}

Input: StartingTime(930),
price1(L),
StartingDate(1110707);

[LegacyColorValue = true];

vars:
Started(false),
PriceW(0),
ShareW(0),
Count(0),
Cumpvol(0),
Cumvol(0),
vol(0),
pvol(0),
midas(0),
midas2(0),
difference(0);

if (date >= StartingDate and time >= StartingTime) or StartingDate = 0 then begin

vol = (Upticks+downticks);
pvol = (price1 * (vol));
Cumpvol = pvol + cumpvol;
Cumvol = vol + cumvol;

ShareW = ShareW + (UpTicks+DownTicks);
Count = Count + 1;
if shareW <>0 then midas = (cumpvol - cumpvol[count])/(Cumvol - cumvol[count]);

Plot1(midas, "MIDAS");

end;