Code Conversion Easy Language to Pro Real Time

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #217407 quote
    dburgh2dburgh2
    Participant
    New

    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!

    #217408 quote
    dburgh2dburgh2
    Participant
    New
    // 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;
    #217430 quote
    JSJS
    Participant
    Master
    // 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
    
    #217439 quote
    dburgh2dburgh2
    Participant
    New

    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;
    #217440 quote
    JSJS
    Participant
    Master

    Hi,

    Sorry, I’m not an Easy Language expert…

    Another problem is that it uses the EL library (using elsystem.collections)…

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Code Conversion Easy Language to Pro Real Time


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
dburgh2 @dburgh2 Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by JSJS
3 years, 2 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/07/2023
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...