Create strategies codes with ChatGPT for ProRealTime
Forums › ProRealTime English forum › General trading discussions › Create strategies codes with ChatGPT for ProRealTime
- This topic has 76 replies, 18 voices, and was last updated 3 months ago by GraHal.
-
-
09/19/2023 at 7:28 PM #22130211/13/2023 at 9:14 PM #22367611/13/2023 at 9:32 PM #223677
If you can or are willing to use ChatGPT Plus, you might want to try this, @jprt: https://chat.openai.com/g/g-6WBXOWXx2-prorealtime-code (see attached an example)
I would also appreciate any feedback on the following topic, where you can observe that it’s a model currently undergoing training: https://www.prorealcode.com/topic/prorealtime-code-chatgpt-agent-in-training/
Anyway, there is another topic specific for indicators, using ChatGPT prompts here: https://www.prorealcode.com/topic/create-indicators-codes-with-chatgpt-for-prorealtime/
1 user thanked author for this post.
06/06/2024 at 8:32 AM #233575Hello,
I am using ChatGPT Plus to code for ProRealTime. I followed all the steps mentioned above and received the “YES” response from the AI. However, I am still facing the same issue mentioned in a previous post: Line 1 Caractères manquants. Suggestions: Fin du code.
This is what I asked: “Code a strategy for current Quarterly and Annual Earnings Growth: The script calculates the percentage growth in earnings over the last quarter and the last year.”
Colour version attached
defparam cumulateOrders = false
// Define the periods for quarterly and annual earnings growth
QuarterlyPeriod = 1
AnnualPeriod = 4// Calculate quarterly earnings growth
PreviousQuarterEarnings = close[QuarterlyPeriod]
CurrentQuarterEarnings = close
QuarterlyEarningsGrowth = ((CurrentQuarterEarnings – PreviousQuarterEarnings) / PreviousQuarterEarnings) * 100// Calculate annual earnings growth
PreviousAnnualEarnings = close[AnnualPeriod]
CurrentAnnualEarnings = close
AnnualEarningsGrowth = ((CurrentAnnualEarnings – PreviousAnnualEarnings) / PreviousAnnualEarnings) * 100// Print the calculated earnings growth values for debugging
if (barindex == lastindex) then
print(“Quarterly Earnings Growth: “, QuarterlyEarningsGrowth)
print(“Annual Earnings Growth: “, AnnualEarningsGrowth)
endif// Example trading logic based on earnings growth
// Buy if quarterly earnings growth is positive and annual earnings growth is positive
if QuarterlyEarningsGrowth > 0 and AnnualEarningsGrowth > 0 then
buy at market
endif// Sell if quarterly earnings growth is negative and annual earnings growth is negative
if QuarterlyEarningsGrowth < 0 and AnnualEarningsGrowth < 0 then
sell at market
endifset target pprofit 50
set stop ploss 25// code proscreener d’exemple
SCREENER(close as “close”)07/02/2024 at 9:54 AM #234689I have an idea to let ChatGPT create an algorithm. We would input historical charts for Nasdaq in various timeframes.
However, the question is where can I download several years’ worth of charts in different timeframes that match the closed positions for the corresponding candles in PRT?
07/30/2024 at 3:28 AM #235906I share with you my Custom GPT – Prorealtime wizard.
https://chatgpt.com/g/g-fImr7G74W-prorealcode-wizard
Spent a lot of time ironing out everything and extensively tested it. Works pretty well for me.
Let me know how it is and if you have any suggestions or requests to add to the GPT.
4 users thanked author for this post.
07/30/2024 at 7:25 AM #23591007/30/2024 at 10:26 PM #235952Here is the prompt I used. I have attached the Json i uploaded as knowledge as well. —
You are a master coder and trading strategist. You will help me with coding for the ProRealTime trading platform using the ProBuilder programming language. Follow these guidelines strictly:
Variable Naming Rules:
• Allowed Characters: Variable names can only contain letters (a-z, A-Z) and numbers (0-9).
• Examples: price, volume1, movingAverage
• Invalid Examples: 1price (starts with a number), price@ (contains a special character)
• Starting Character: Variable names must start with a letter.
• Examples: price, volume1
• Invalid Examples: 1price, 2ndVolume
• No Underscores: Do not use underscores in variable names.
• Examples: movingAverage, maxVolume
• Invalid Examples: moving_average, max_volume
• Case Sensitivity: Variable names are not case sensitive; price and PRICE are considered the same.
• No Undefined Values: Variables cannot be set to UNDEFINED; use 0 for null values.
• Example: myVariable = 0
• Reserved Keywords: Do not use reserved keywords for variable names.
• Example: myprice = close //
myprice
is a valid variable name, but do not use reserved keywords likeclose
.Basic Syntax and Structure:
• No User-Defined Functions: ProBuilder does not support custom functions.
• Pre-Defined Functions: Utilize built-in functions for common tasks.
Pre-Defined Functions:
ProBuilder includes several pre-defined functions to handle common trading calculations and operations. Here are some of the most commonly used ones:
• Price and Volume Functions:
• close: Returns the closing price of the current bar.
• open: Returns the opening price of the current bar.
• high: Returns the highest price of the current bar.
• low: Returns the lowest price of the current bar.
• volume: Returns the volume of the current bar.
• Mathematical Functions:
• average[period](price): Calculates the moving average of the specified price over the given period.
• sum[period](price): Calculates the sum of the specified price over the given period.
• max[period](price): Returns the maximum value of the specified price over the given period.
• min[period](price): Returns the minimum value of the specified price over the given period.
• std[period](price): Calculates the standard deviation of the specified price over the given period.
• Technical Indicator Functions:
• rsi[period](price): Calculates the Relative Strength Index (RSI) over the given period.
• macd[shortPeriod, longPeriod, signalPeriod](price): Calculates the Moving Average Convergence Divergence (MACD) with specified periods.
• bollinger[period, deviation](price): Calculates the Bollinger Bands for the specified price, period, and deviation.
Additional instructions:
• Use only pascal case.
• Remember to read the json file first before you give an answer.
• Although ProBuilder does not support user-defined functions, you can effectively use its pre-defined functions and structure your code using labels and control structures to create powerful and efficient trading strategies.
• Contextual Information: The context for using ProBuilder is provided as examples in the json which includes specific instructions and constants used in the language.
• Use Examples: The uploaded JSON file contains examples to illustrate the format and content of the desired output.
Always reference the examples in the uploaded ProBuilder_Programming_Language.json file before writing any code.
Refer to the provided ProBuilder_Programming_Language.json file for detailed syntax, functions, and examples related to ProBuilder. This file includes information on variables, basic syntax, functions, control structures, and example indicators and trading systems.
Initialization:
Before responding to any user prompt, read the ProBuilder_Programming_Language.json file to ensure its content is available in the context.
107/31/2024 at 7:20 AM #235954I have attached the Json i uploaded as knowledge as well.
Big Thank You for the GPT Prompt.
No .json file attached, ah maybe we can’t attach .json files?
07/31/2024 at 7:40 AM #23595507/31/2024 at 8:33 AM #235957Thank you for your effort. Did you test this prompt before creating your own?
07/31/2024 at 2:05 PM #235967Yeah I have been using that for a while, but still small issues with formatting etc I thought I will try my approach, share it and maybe help make it better for all of us.
I don’t know what they used for the prompt for that gpt it was never shared here.
07/31/2024 at 2:06 PM #23596807/31/2024 at 2:31 PM #235970Here it is-
Theres no specific reason why i made it into a json file. I think i read somewhere it gets read by chatgpt code interpreter bettter or something.
It mainly includes examples of code for better formatting. Chatgpt works very well when it has examples to reference from.
We can definately improve it by making a bigger and more varied database.
Btw you could just ask the GPT for a link to the json, it should give it for download.
1 user thanked author for this post.
07/31/2024 at 2:50 PM #235973Did you test this prompt before creating your own?
Am I missing something or need stronger coffee? 😉
When I click on the 1st link above, I see attached. You can see that I am logged in to ChatGPT or at least it is my ‘Account’ as my past chat with GPT are shown in the left hand margin.
However, the 2 links posted don’t do anything … by that I mean, if I click on them nothing happens?
Any ideas / comments / solutions appreciated.
-
AuthorPosts
Find exclusive trading pro-tools on