I have about 10-15 premarket and postmarket functions from Easy Language (TradeStation) that I’d like to convert to Pro Real Time so I can continue to support Pro Real Time. I am hard pressed for time and looking for community (or private) help. Please contact me if interested!
// PrePostMarketMax
input: start_time ( numeric ), // 1600
end_time ( numeric ) // 930 EST
;
if time >= start_time and time[1] < start_time then begin
value1 = close;
end;
if time > start_time or time <= end_time then
value2 = iff(value1 <> 0, (close/value1 - 1) * 100, 0);
PrePostMarketMax = value2;
JSParticipant
Senior
// PrePostMarketMax
StartTime = 160000 // 1600
EndTime = 093000 // 930 EST
If time >= StartTime and time[1] < StartTime then
value1 = close
EndIf
if time > StartTime or time <= EndTime then
If value1 <> 0 then
value2 = (close/value1 - 1) * 100
EndIf
EndIf
PrePostMarketMax = value2
Return PrePostMarketMax
Thank you. It is as I suspected. I can manage most very quickly, but can you assist with this one?
using elsystem;
using elsystem.collections;
inputs: Start_time (numeric ), // 0401
End_time ( numeric ) , // 930
Length ( numeric ) ; // 10
{
Vars: Start_time(0401),
End_time(0930),
Length(10);
}
Vars: double AnyVol(0),
double TodayVol(0),
double AvgDayVol(0), double DayRatio(0),
double AvgTimeVol(0), double TimeRatio(0),
Vector volVect(null),
Vector timeVect(null),
Dictionary timeDict(null),
int counter(0),
int xx(0),
IntrabarPersist FirstTickOfBar(false);
once begin
volVect = new Vector;
timeVect = new Vector;
timeDict = new Dictionary;
for xx = 0 to Length-1 begin
volVect.push_back(0 astype double);
end;
end;
//Work out this bar's volume
if BarType >= 2 and BarType < 5 then begin { Daily, Weekly, or Monthly bars }
AnyVol = Volume;
end
else begin
AnyVol = Ticks;
end;
//
if time = Start_time and ( time[1] < Start_time or date <> date[1] ) then begin
//Save yesterday's volume
VolVect[counter] = TodayVol astype double;
//Update the position of the vector. Circle back to 0 if greater than length.
counter = counter + 1;
if counter >= Length then counter = 0;
//Find the average of the vector
AvgDayVol = VectorAverage(volVect, Length);
end;
//Reset our running volume count
if time = Start_time and ( time[1] < Start_time or date <> date[1] ) then begin
TodayVol = 0;
end;
//Running volume
if time >= Start_time and time <= End_time then begin
TodayVol = TodayVol + AnyVol;
end;
if BarStatus(1) = 2 and time >= Start_time and time <= End_time then begin
if timeDict.Contains(NumToStr(time, 0)) then begin
timeVect = timeDict.Items[NumToStr(time, 0)] astype Vector;
end
else begin
for xx = 0 to Length-1 begin
timeVect.push_back(0 astype double);
end;
timeDict.Add(NumToStr(time, 0), timeVect astype Vector);
end;
//Find the average of the vector
AvgTimeVol = VectorAverage(timeVect, Length);
timeVect[counter] = TodayVol astype double;
timeDict.Items[NumToStr(time, 0)] = timeVect astype Vector;
timeVect = new Vector;
end;
if AvgDayVol > 0 then begin
DayRatio = TodayVol/AvgDayVol;
end
else begin
DayRatio = 0;
end;
if AvgTimeVol > 0 then begin
TimeRatio = TodayVol/AvgTimeVol;
end
else begin
TimeRatio = 0;
end;
FirstTickOfBar = BarStatus(1) = 2;
PreMarketRelativeVolume = DayRatio;
JSParticipant
Senior
Hi,
Sorry, I’m not an Easy Language expert…
Another problem is that it uses the EL library (using elsystem.collections)…