Here is a prompt that works for me quite well. —
I need some help generating codes for the trading platform ProRealTime. Its programming language is ProBuilder (also known as ProRealCode).
Variables names can only contain letters and numbers and always starting with a letter, no underscore and no special character allowed, also they are not case sensitive.
_To set a pending buy stop order at price X, price must be below the price X, use the instruction: BUY AT X STOP
_To add a trailing stop of X points, use the instruction: SET STOP PTRAILING X
_The upper bollinger band of period X iand deviation Y is calculated with the instruction: AVERAGE[X]+STD[X]*Y
_To get the point value in money use the constant: POINTVALUE
_To get the point size use the constant: POINTSIZE
_To get the average price of current positions use: POSITIONPRICE
_To get profit in money of current positions use this snippet:
floatingprofit = (((close-positionprice)*pointvalue)*countofposition)/pointsize //actual trade gains
Conditional IF instruction:
Syntax: IF condition THEN action ENDIF
Syntax: IF condition THEN action1 ELSE action2 ENDIF
Syntax: IF condition1 THEN IF condition2 THEN action1 ELSE action2 ENDIF ENDIF
Syntax: IF condition1 THEN action1 ELSIF condition2 THEN action2 ELSE actionN ENDIF
Iterative FOR Loop:
Syntax: FOR variable = beginningValue TO endingValue DO action NEXT
Descending loop (FOR, DOWNTO, DO, NEXT):
Syntax: FOR variable = endingValue DOWNTO beginningValue DO action NEXT
Conditional WHILE Loop:
Syntax: WHILE condition DO action1 … actionN WEND
BREAK instruction:
Used to exit a WHILE or FOR loop prematurely based on certain conditions.
CONTINUE instruction:
Used to skip the remaining code within the current iteration of a WHILE or FOR loop and move to the next iteration.
ONCE instruction:
Used to initialize a variable with a specific value “only once” during program execution.
Common unary and binary functions:
Includes functions like MIN, MAX, ROUND, ABS, SGN, SQUARE, SQRT, LOG, POW, EXP, COS, SIN, TAN, ACOS, ASIN, ATAN, FLOOR, CEIL, RANDOM.
Common mathematical operators:
Operators such as <, <= (or =<), >, >= (or =>), =, <> (not equal to).
Charting comparison functions:
CROSSES OVER and CROSSES UNDER for chart curves or lines.
Summation functions:
CUMSUM and SUMMATION for cumulative sum and sum of values over a specified number of bars.
Statistical functions:
LOWEST, HIGHEST, STD, and STE for finding lowest, highest, standard deviation, and standard error.
Logical operators:
NOT, OR, AND, XOR for performing logical operations and creating conditional expressions.
Arrays (Data tables):
Arrays are used to store multiple values or selectively store values. Prefixed with ‘$’ symbol.
ArrayMax($Array): Returns the highest defined value in the array, ignoring automatically filled zeros.
ArrayMin($Array): Returns the smallest defined value in the array, ignoring automatically filled zeros.
ArraySort($Array, MODE): Sorts the array in ascending (ASCEND) or descending (DESCEND) order, removing automatically filled zeros.
IsSet($Array[Index]): Returns 1 if the index of the array is defined, 0 if it’s not. Automatically filled zeros are not considered as defined.
LastSet($Array): Returns the highest defined index of the array. If no index is defined, it returns -1.
UnSet($Array): Resets the array by deleting its contents completely, setting all elements to 0.
Instruction to open/close positions:
Syntax: BUY, SELL, SELLSHORT, EXITSHORT for opening and closing long/short positions.
Now let’s start programming, answer “YES” and nothing else if you are ready and wait for my next prompt.