How can first program ABC.ring call second program DEF.ring

213 views
Skip to first unread message

Bert Mariani

unread,
Nov 28, 2025, 11:58:48 AM (10 days ago) Nov 28
to The Ring Programming Language
Hello Mahmoud

I have a problem with this issue ...
1st program Create2DList.ring  generates a 2dList 
Calls 2nd program  ChartPrint2DList.ring  which will Print the 2DList and later Draw a Chart
I need to call the 2nd program Program  and not the internal Functions
         ChartPrint2DList.ring (a2DList) 
How do you do it ?
How do I call it ?

Programs are attached.

if I define
   load "ChartPrint2DList.ring"    //  Call FUNC
   Print2DList(a2DTest)               // Calls Func  IN  "Chart-Print2DList.ring"

 //  load "ChartPrint2DList.ring"   // Comment Out
if I call  the program  ChartPrint2DList.ring (a2DList)  // FAILS

It only shows 2 sysArgs and not the 3rd for the 2DList
     sysArgV: 1 ring.exe
     sysArgV: 2 ChartPrint2DList.ring


/===============================================

load "ChartPrint2DList.ring"   // <<< Will call Func , But Not program

    See nl+"IN Create2DList.ring "+nl
    a2DTest = List(3,4)
    for Row = 1 to 3
        for Col = 1 to 4
            a2DTest[Row][Col] = Row *Col
        next
    next
   
    DebugArray(a2DTest)       // Before calling Pring2DList

See nl+"CALL: Print2DList.ring(a2DTest) "+nl  
        Print2DList(a2DTest)    // Calls Func  IN  "Chart-Print2DList.ring"

See nl+"CALL: ChartPrint2DList.ring(a2DTest) "+nl
ChartPrint2DList.ring(a2DTest)   // COMPLAINS

===================================
GOOD

CALL: Print2DList.ring(a2DTest)

Now IN Print2DList : Where is sysArgV a2DTest ?
1 2 3 4
2 4 6 8
3 6 9 12
<----- 2 End Called Debug 2DArray ----->

======================================
FAILS

Line 22 Error (R24) : Using uninitialized variable: chartprint2dlist
in file C:/MyStuff/AA-Curl-DISTRIB-Ring124/Create2DList.ring

Create2DList.ring
ChartPrint2DList.ring

Ilir Liburn

unread,
Nov 28, 2025, 1:00:52 PM (10 days ago) Nov 28
to The Ring Programming Language
Hello Bert,

we talked about this long time ago. Separate processes use separate memory. Ring doesn't support shared memory between the processes.

You need inter-process communication which you can implement using files (pipes) or sockets, command line arguments (only at the start of the process) or Qt


Greetings,
Ilir

Mahmoud Fayed

unread,
Nov 28, 2025, 1:28:17 PM (10 days ago) Nov 28
to The Ring Programming Language
Hello Bert, Ilir

We have the next useful functions
(1) isMainSourceFile() from stdlibcore.ring:  Stdlib Functions — Ring 1.24.0 documentation
(2) appArguments() from stdlibcore.ring: Stdlib Functions — Ring 1.24.0 documentation
 
Using these three functions we can control the behaviour of our source code file 
* Determine code to be executed if our program is the main program (used like ring myprogram.ring)
* Determine code to be executed if our program is the sub program (used like load "myprogram.ring")
* Get application arguments (sysargv) taking in mind if the program could be executed using (ring.exe) or as standalone executable (myprogram.exe)
* Check if a global program does exist (could be used by the caller program to send parameters)

Greetings,
Mahmoud 

Bert Mariani

unread,
Nov 28, 2025, 1:32:15 PM (10 days ago) Nov 28
to The Ring Programming Language
Hello Mahmoud

If 1st Program Writes  to  OutputData.txt file and closes the file.
How can it Call the 2nd Program, which will Read the OutputData.txt  and process it ?

Mahmoud Fayed

unread,
Nov 28, 2025, 1:40:54 PM (10 days ago) Nov 28
to The Ring Programming Language
Hello Bert

>> "How can it Call the 2nd Program, which will Read the OutputData.txt  and process it ?"

Many options

If the first program writes the code directly, in global scope, just use the Load command after creating OutputData.txt

But, A better way, is to call a function in the second program and keep load command at the start

And control code executed in the second program using isMainSourceFile() - To determine code that will be executed only if the second program is the main program.

Greetings,
Mahmoud

Bert Mariani

unread,
Nov 28, 2025, 2:29:08 PM (10 days ago) Nov 28
to The Ring Programming Language
Hello Mahmoud, Illir

Attached:
     Create2DList.ring
     ChartPrint2DList.ring

Labeled the Sequence of Calls ... First, Second, Third, Fouth
Used:  system( ChartPrint2DList.ring(a2DTest)  as the 4th Call 

Weird Sequence Output ... 4th Call outputs  before the rest
Wondering why ?

// ===============================================
// Create 2DList  Code

    See nl+"First IN Create2DList.ring "+nl

    a2DTest = List(3,4)
    for Row = 1 to 3
        for Col = 1 to 4
            a2DTest[Row][Col] = Row *Col
        next
    next
   
    DebugArray(a2DTest)       // Before calling Pring2DList

See nl+"Second CALL: Print2DList.ring(a2DTest) "+nl  
    Print2DList(a2DTest)    // ===>>> NEED load "Chart-Print2DList.ring"

See nl+"Third CALL: system( ChartPrint2DList.ring(a2DTest) "+nl
system( "ChartPrint2DList.ring(a2DTest)" )
   
// =================================== 

===============================
Weird sequence  Output

Fourth IN ChartPrint2DList
sysArgV: 1 C:\ring\bin/ring.exe
sysArgV: 2 C:/MyStuff/AA-Curl-DISTRIB-Ring124/Create2DList.ring

<--- Srt Internal ChartPrint2DList a2D --->
<----- 2 Start ChartPrint Debug 2DArray ----->
3 2 1
7 6 5
9 8 7
<----- 2 End ChartPrint Debug 2DArray ----->

<--- End Internal ChartPrint2DList a2D --->

First IN Create2DList.ring

<----- 1 Start Create2D Debug 2DTest ----->

1 2 3 4
2 4 6 8
3 6 9 12
<----- 1 End Create2D Debug 2DTest ----->

Second CALL: Print2DList.ring(a2DTest)

Now IN Print2DList: 2DTest
<----- 2 Start ChartPrint Debug 2DArray ----->

1 2 3 4
2 4 6 8
3 6 9 12
<----- 2 End ChartPrint Debug 2DArray ----->

Third CALL: system( ChartPrint2DList.ring(a2DTest)

ChartPrint2DList.ring
Create2DList.ring

Mahmoud Fayed

unread,
Nov 28, 2025, 2:35:40 PM (10 days ago) Nov 28
to The Ring Programming Language
Hello Bert

As Ilir said, using  system( "ChartPrint2DList.ring(a2DTest)" ) is not the right way to pass a Ring list to another program

If you want a simple way to pass a list, write this list to a file, then read this file from the called program

You can use the next functions
(1) List2Code() from stdlibcore.ring:  Stdlib Functions — Ring 1.24.0 documentation

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Nov 28, 2025, 2:37:56 PM (10 days ago) Nov 28
to The Ring Programming Language
Hello Bert

If you will use List2Code() and Read()
Then you will need Eval() after using Read()
Also, it's expected to use variable assignment, so the list is stored inside a variable

Greetings,
Mahmoud 

Mahmoud Fayed

unread,
Nov 28, 2025, 2:54:43 PM (10 days ago) Nov 28
to The Ring Programming Language
Hello Bert

>> "If you want a simple way to pass a list, write this list to a file, then read this file from the called program"

This statement assumes that the programs will be executed as different executable files 
So, we need a way of communication (IPC, Files, Sockets, Database, etc.)

But if you don't have this case, i.e. just two source code files written in Ring and you have full control to write/organize them
Then there is no need for this complexiity

Just use a global variable (for the list that you want to share) then use isGlobal() in the sub program to check/use it
Or just pass the list as parameter to a function in the sub program (Simple & Better)

Greetings,
Mahmoud

Bert Mariani

unread,
Nov 29, 2025, 11:03:29 AM (9 days ago) Nov 29
to The Ring Programming Language
Hello Mahmoud, Illir

All this does not make sense. Seems convoluted

Line 43 Error (R5) : Can't access the list item, Object is not list
In function debug2darray() in file C:\MyStuff\AA-Curl-DISTRIB-Ring124\ChartPrint2DList-2.ring

it should be simple logical steps
      First program Writes  the 2DList  as a file  "AAA-Output.txt"   ( codeString = list2Code(a2DTest)
      Calls Second program  ( No Call Command  exists )
      Second program reads the file   " AAA-Output.txt"  ( Looks like 2DList)
                   Fails - Does not recognize data as a 2DList ??

When using  load in First program ...  
     load "ChartPrint2DList-2.ring"  // ===>>> CALLS the Second program First ???  Why

So I put the "load" at the END of the First program !
Which now calls the Second program
Why is there not a Call Command for the Second program

Why is an EVAL() command required after the Read()
EVAL what ??
The Read Data looks visually fine.

========================================
First IN Create2DList.ring

<----- 1 Start IN Debug Create2D Debug 2DTest ----->

1 2 3 4
2 4 6 8
3 6 9 12
<----- 1 End In Debug Create2D Debug 2DTest ----->
<--- Srt Generated codeString --->
[
        [
                1,
                2,
                3,
                4
        ],
        [
                2,
                4,
                6,
                8
        ],
        [
                3,
                6,
                9,
                12
        ]
]<--- End Generated codeString --->

Third CALL: for LOAD ChartPrint2DList-2.ring

Fourth IN ChartPrint2DList


<--- Srt Debug ChartPrint2DList Internal a2DList --->
<----- 2 Srt IN Debug ChartPrint2DList-2  2DArray ----->

3 2 1
7 6 5
9 8 7
<----- 2 End IN Debug ChartPrint2DList-2  Debug 2DArray ----->

<--- End Debug ChartPrint2DList Internal a2DList --->

<--- Srt ChartPrint2DList See Read File List2Code   --->
[

        [
                1,
                2,
                3,
                4
        ],
        [
                2,
                4,
                6,
                8
        ],
        [
                3,
                6,
                9,
                12
        ]
]
<--- End ChartPrint2DList See Read File aListCode   --->

<--- Srt ChartPrint2DList Debug aListCode   --->
<----- 2 Srt IN Debug ChartPrint2DList-2  2DArray ----->

Line 43 Error (R5) : Can't access the list item, Object is not list
In function debug2darray() in file C:\MyStuff\AA-Curl-DISTRIB-Ring124\ChartPrint2DList-2.ring

Called from line 28 in file C:/MyStuff/AA-Curl-DISTRIB-Ring124/Create2DList-2.ring
ChartPrint2DList-2.ring
Create2DList-2.ring
AAA-Output.txt

Mahmoud Fayed

unread,
Nov 29, 2025, 12:57:51 PM (9 days ago) Nov 29
to The Ring Programming Language
Hello Bert

An example using List2Code() and Eval()

load "stdlibcore.ring"

aList = [ [1,2,3],
  [4,5,6] ]

cListAsString = list2code(aList)
?   cListAsString    

cCode = "aAnotherList = " +   cListAsString    
eval(cCode)


? aAnotherList

Output:

[
        [
                1,
                2,
                3
        ],
        [
                4,
                5,
                6
        ]
]
1
2
3
4
5
6

Comments:

(1) Using List2Code() generate a String that contains Ring code that represent the List Contents
(2) Adding  "aAnotherList = " before this list determine the variable name that will contains this list
(3) Using Eval() execute the code (stored inside a string) and create the variable (which contains the list), So Ring code can use this list
(4) You can use write() and read() functions to save cListAsString to txt/data/ring files 

if you have all files in one program (one executable), A better way is using isMainSourceFile(), defining a function that accept the list, i.e. no need for List2Code(), eval(), etc. 

Greetings,
Mahmoud

Ilir Liburn

unread,
Nov 29, 2025, 2:41:59 PM (9 days ago) Nov 29
to The Ring Programming Language
Hello Bert, Mahmoud

load "ChartPrint2DList-2.ring"        // ===>>> CALLS the program
System("ChartPrint2DList-2.ring")

Since load "ChartPrint2DList-2.ring" is used, question is why you are calling another program when you already loaded the code printing the list? Load doesn't calls the program, load generates the bytecode so that list printing function can be called.

That's what is Mahmoud trying to tell you.

Greetings,
Ilir

Bert Mariani

unread,
Nov 29, 2025, 3:24:02 PM (9 days ago) Nov 29
to The Ring Programming Language
Hello Mahmoud, Ilir

(Removed the "System" cmd)

Updated both First Initial program - Create2DList-2.ring
and the Second Called program- ChartPrint2DList.2.ring
Looks like it works
But the Output File to read by the Second Called program is hardcoded.

Question: 
I have this code at the End of the First program -- Create2DList-2.ring
How do I pass it the Name of the Output file --  cFileName = "AAA-Output.txt"  to  ChartPrint2DList-2.ring

             See nl+"Third CALL: for LOAD ChartPrint2DList-2.ring "+nl
load "ChartPrint2DList-2.ring"        // ===>>> CALLS the program

Doing a --  load "ChartPrint2DList-2.ring"   -- doesn't make any sense to me. Can't pass Parms
Ring should have a  -- CallProg( ProgName, Parm1, Parm2 ...) 

==============================
Output
First IN Create2DList.ring

<----- 1 Start IN Debug Create2D Debug 2DTest ----->
1 2 3 4
2 4 6 8
3 6 9 12

<----- 1 End In Debug Create2D Debug 2DTest ----->
<--- Srt Generated codeString --->
[
        [
                1,
                2,
                3,
                4
        ],
        [
                2,
                4,
                6,
                8
        ],
        [
                3,
                6,
                9,
                12
        ]
]<--- End Generated codeString --->

Third CALL: for LOAD ChartPrint2DList-2.ring

Fifth CALLED Now IN ChartPrint2DList

sysArgV: 1 C:\ring\bin/ring.exe
sysArgV: 2 C:/MyStuff/AA-Curl-DISTRIB-Ring124/Create2DList-2.ring

<--- Srt ChartPrint2DList See Read File aListCode -> aNewList --->

1
2
3
4
2
4
6
8
3
6
9
12

<--- Srt ChartPrint2DList Debug aNewList   --->
<----- 2 Srt IN Debug ChartPrint2DList-2  2DArray ----->
1 2 3 4
2 4 6 8
3 6 9 12

<----- 2 End IN Debug ChartPrint2DList-2  2DArray ----->

<--- End ChartPrint2DList Debug aNewList   --->

BACK IN Create2DList.ring


ChartPrint2DList-2.ring
Create2DList-2.ring

Ilir Liburn

unread,
Nov 29, 2025, 4:13:42 PM (9 days ago) Nov 29
to The Ring Programming Language
Hello Bert,

since you Removed the "System" cmd, you don't need anymore inter-process communication. Remove sections which write/read file content.

All what you need to do now is to use Debug2DArray(a2DTest) in ChartPrint2DList-2.ring because a2DTest is now global variable created in Create2DList-2.ring.

Greetings,
Ilir

Azzeddine Remmal

unread,
Nov 29, 2025, 4:42:28 PM (9 days ago) Nov 29
to The Ring Programming Language
Hello Bert, Mahmoud, Walir, and everyone 

I've been following the conversation, but I don't understand what you're trying to achieve. 
Could you please describe in clear terms what you want to do so we can understand how to help? 
I don't need examples
please specify what you want first.
 Regards, Azzeddine

Azzeddine Remmal

unread,
Nov 29, 2025, 4:50:51 PM (9 days ago) Nov 29
to The Ring Programming Language
Hello Bert, 
You are correct that load in Ring acts more like a copy-paste or #include mechanism rather than a function call.
It executes the code in the current scope immediately.

Here are the two ways to handle this:

Option 1: Shared Scope (Easiest)
Since load shares the variable scope, you simply define the variable before the load command.

In Create2DList-2.ring:

// Define the variable first
cFileName = "AAA-Output.txt"

see nl+"Third CALL: for LOAD ChartPrint2DList-2.ring "+nl
load "ChartPrint2DList-2.ring"  // This file can now "see" cFileName
In
ChartPrint2DList-2.ring
: You can just use cFileName directly. (You correctly commented out the hardcoded assignment in your recent edit).

Option 2: Wrap in a Function (Cleaner)
If you want a syntax like CallProg(Name), you must wrap the code in the second file into a function.

1. Modify
ChartPrint2DList-2.ring
: Wrap the logic inside a function definition.

func ChartPrint2DList(cOutputName)
    see "Processing file: " + cOutputName + nl
    // ... rest of your code using cOutputName ...
2. Modify Create2DList-2.ring: Load the file once to define the function, then call it.

load "ChartPrint2DList-2.ring"

// Now you can pass parameters
ChartPrint2DList("AAA-Output.txt")

 Regards, Azzeddine

Bert Mariani

unread,
Nov 29, 2025, 8:17:44 PM (9 days ago) Nov 29
to The Ring Programming Language
Hello Azzeddine et ALL

This is what I am trying to do
Using 3 separate programs. 
Currently Running each one manually
Output of one is used by next program

    Program-1  Curl-Get-HIS-NASD-100.ring Output AAA-SpreadSheet.csv
    Program-2  YearlyReturns.ring                 Output AAA-CompareResult.csv
    Program-3  DrawChart.ring                       Output Chart

Fetch the NASD-100 stock data
    Program-1  Curl-Get-HIS-NASD-100.ring
        Display Closing Prices
            AAPL, 129.17, 128.46, 118.04, 119.08, 128.16, 121.48, 133.75, 142.44,
            ADBE, 500.12, 458.77, 459.67, 475.37, 508.34, 504.58, 585.64, 621.63,
           
        Save the Data as CSV to AAA-SpreadSheet.csv

            QQQ     304.3   305.65  305.24  310.09  328.83  324.88  344.83
            AAPL    129.17  128.46  118.04  119.08  128.16  121.48  133.75
            ABNB    183.63  206.35  187.94  172.71  140.4   153.14  144.01
            ADBE    500.12  458.77  459.67  475.37  508.34  504.58  585.64
                      
Calculate Yearly Returns for Best Performing Top 10 stocks
    Program-2  YearlyReturns.ring
        Read AAA-SpreadSheet.csv
        Do calculations

        Show Recent Top 10
            <----- Show Top10 Current  ----->
            1 APP     WBD     WBD     MU      WBD
            2 AMD     APP     APP     INTC    MU
            3 AVGO    MU      MU      WBD     INTC
            4 MU      INTC    AMD     GOOGL   AMAT        
       
        Compare Returns to QQQ Index based on a selection mechanism.
            QQQ  1.42 1.44 1.58 1.67 1.72 1.73 1.82 1.91 1.88 1.88
            TOT  2.31 2.38 2.49 2.47 2.36 2.70 3.16 3.08 3.08 3.08

        Save the Compare data as a CSV to AAA-CompareResult.csv

Draw the Chart of the Comparison or Total Return versus Stock Index
    Program-3  DrawChart.ring
        Read AAA-CompareResult.csv
        Draw the Compare Chart 

CompareChart-Snap1.png

Azzeddine Remmal

unread,
Nov 30, 2025, 2:20:42 AM (8 days ago) Nov 30
to The Ring Programming Language
Hello Bert, 

λ ring MainController.ring
==========================================
Starting Stock Analysis Process (3 Stages)
==========================================
1. Running: Curl-Get-HIS-NASD-100.ring ...
==========================================
Connecting to Yahoo Finance (via cURL)...
Fetching 3 months of historical data...
==========================================
Fetching: QQQ ... Done (64 days, last price: 619.25)
Fetching: AAPL ... Done (64 days, last price: 278.85)
Fetching: ABNB ... Done (64 days, last price: 116.99)
Fetching: ADBE ... Done (64 days, last price: 320.13)
Fetching: MSFT ... Done (64 days, last price: 492.01)
Fetching: AMZN ... Done (64 days, last price: 233.22)
Fetching: TSLA ... Done (64 days, last price: 430.17)
Fetching: GOOGL ... Done (64 days, last price: 320.18)
Fetching: NVDA ... Done (64 days, last price: 177)
Fetching: META ... Done (64 days, last price: 647.95)
==========================================
Successfully saved to AAA-SpreadSheet.csv
==========================================
>> AAA-SpreadSheet.csv created successfully.

2. Running: YearlyReturns.ring ...
==========================================
Starting return calculations and top 10 analysis...
==========================================

==========================================
<----- Top 10 Best Performing Stocks Daily ----->
==========================================
Day | Top 10 Stocks (Ranked by Performance)
----|----------------------------------------
 1  | ADBE MSFT AAPL ABNB AMZN NVDA META TSLA GOOGL
 2  | MSFT META GOOGL AAPL TSLA AMZN NVDA ABNB ADBE
 3  | GOOGL AAPL TSLA META MSFT AMZN NVDA ADBE ABNB
 4  | GOOGL AAPL AMZN TSLA META MSFT NVDA ADBE ABNB
 5  | GOOGL TSLA AAPL META AMZN ADBE MSFT NVDA ABNB
 6  | GOOGL TSLA AMZN AAPL META ADBE MSFT NVDA ABNB
 7  | GOOGL AMZN TSLA META AAPL ADBE MSFT NVDA ABNB
 8  | GOOGL TSLA NVDA META AMZN MSFT ADBE AAPL ABNB
 9  | GOOGL TSLA NVDA META AMZN AAPL MSFT ADBE ABNB
10  | TSLA GOOGL META NVDA AAPL MSFT AMZN ADBE ABNB
11  | TSLA GOOGL META NVDA AAPL MSFT AMZN ADBE ABNB
12  | TSLA GOOGL META AAPL AMZN MSFT NVDA ADBE ABNB
13  | TSLA GOOGL META AAPL ADBE AMZN MSFT NVDA ABNB
14  | TSLA GOOGL META ADBE AAPL NVDA AMZN MSFT ABNB
15  | TSLA GOOGL AAPL META ADBE MSFT NVDA AMZN ABNB
16  | TSLA GOOGL AAPL NVDA META ADBE MSFT AMZN ABNB
17  | TSLA GOOGL AAPL NVDA META ADBE MSFT AMZN ABNB
18  | TSLA GOOGL AAPL META NVDA MSFT ADBE AMZN ABNB
19  | TSLA GOOGL AAPL NVDA META MSFT ADBE AMZN ABNB
20  | TSLA GOOGL AAPL NVDA ADBE MSFT META AMZN ABNB
21  | TSLA GOOGL AAPL NVDA MSFT ADBE META AMZN ABNB
22  | TSLA GOOGL AAPL NVDA MSFT META ADBE AMZN ABNB
23  | TSLA GOOGL AAPL NVDA MSFT META ADBE AMZN ABNB
24  | TSLA GOOGL AAPL NVDA MSFT ADBE META AMZN ABNB
25  | TSLA GOOGL AAPL NVDA MSFT ADBE META AMZN ABNB
26  | TSLA GOOGL AAPL NVDA MSFT ADBE META AMZN ABNB
27  | TSLA GOOGL AAPL NVDA MSFT ADBE AMZN META ABNB
28  | TSLA GOOGL AAPL NVDA MSFT AMZN ADBE META ABNB
29  | TSLA GOOGL NVDA AAPL MSFT AMZN META ADBE ABNB
30  | TSLA GOOGL AAPL NVDA MSFT META ADBE AMZN ABNB
31  | TSLA GOOGL NVDA AAPL MSFT META AMZN ADBE ABNB
32  | TSLA GOOGL AAPL NVDA MSFT META AMZN ADBE ABNB
33  | TSLA GOOGL AAPL NVDA MSFT META ABNB AMZN ADBE
34  | TSLA GOOGL AAPL NVDA MSFT META ABNB AMZN ADBE
35  | TSLA GOOGL AAPL NVDA MSFT META ABNB ADBE AMZN
36  | TSLA GOOGL AAPL NVDA MSFT META ABNB ADBE AMZN
37  | TSLA GOOGL AAPL NVDA MSFT ADBE META ABNB AMZN
38  | TSLA GOOGL AAPL NVDA MSFT META ADBE ABNB AMZN
39  | TSLA GOOGL AAPL NVDA MSFT META ADBE ABNB AMZN
40  | TSLA GOOGL AAPL NVDA MSFT META ADBE ABNB AMZN
41  | TSLA GOOGL AAPL NVDA MSFT META ADBE AMZN ABNB
42  | TSLA GOOGL AAPL NVDA MSFT META ADBE AMZN ABNB
43  | TSLA GOOGL NVDA AAPL MSFT META AMZN ABNB ADBE
44  | GOOGL TSLA AAPL NVDA MSFT AMZN ABNB ADBE META
45  | TSLA GOOGL AAPL NVDA AMZN MSFT ABNB ADBE META
46  | TSLA GOOGL NVDA AAPL AMZN MSFT ABNB ADBE META
47  | TSLA GOOGL AAPL NVDA AMZN MSFT ADBE ABNB META
48  | TSLA GOOGL AAPL NVDA AMZN MSFT ADBE ABNB META
49  | GOOGL TSLA AAPL NVDA AMZN MSFT ABNB ADBE META
50  | GOOGL TSLA AAPL NVDA AMZN MSFT ABNB ADBE META
51  | GOOGL TSLA AAPL NVDA AMZN MSFT ADBE ABNB META
52  | GOOGL TSLA AAPL NVDA AMZN MSFT ABNB ADBE META
53  | GOOGL TSLA AAPL NVDA AMZN MSFT ADBE ABNB META
54  | GOOGL TSLA AAPL NVDA AMZN MSFT ADBE ABNB META
55  | GOOGL TSLA AAPL NVDA AMZN MSFT ABNB ADBE META
56  | GOOGL TSLA AAPL NVDA AMZN MSFT ADBE ABNB META
57  | GOOGL TSLA AAPL NVDA MSFT AMZN ADBE ABNB META
58  | GOOGL TSLA AAPL NVDA AMZN MSFT ADBE ABNB META
59  | GOOGL TSLA AAPL NVDA AMZN MSFT ADBE ABNB META
60  | GOOGL TSLA AAPL NVDA AMZN MSFT ADBE ABNB META
61  | GOOGL TSLA AAPL NVDA AMZN MSFT ADBE ABNB META
62  | GOOGL TSLA AAPL NVDA AMZN MSFT ABNB ADBE META
63  | GOOGL TSLA AAPL NVDA AMZN MSFT ABNB ADBE META
64  | GOOGL TSLA AAPL AMZN NVDA MSFT ADBE ABNB META
==========================================

==========================================
PERFORMANCE SUMMARY
==========================================
QQQ Index Return:       8.56%
Top 10 Portfolio (TOT): 7.45%
------------------------------------------
Underperformance:       -1.12%
Status:                 QQQ WINS
==========================================
>> Data saved to AAA-CompareResult.csv
==========================================
>> AAA-CompareResult.csv created successfully.

3. Running: DrawChart.ring ...
>> Chart displayed successfully.
==========================================
All operations completed.
==========================================
Capture.PNGCapture2.PNG


Regards, Azzeddine
MainController.ring
DrawChart.ring
YearlyReturns.ring
Curl-Get-HIS-NASD-100.ring

Bert Mariani

unread,
Nov 30, 2025, 11:18:45 AM (8 days ago) Nov 30
to The Ring Programming Language
Hello Azzeddine

Thanks for the feedback and suggestions !!

I was looking at the AI generated code.
Looks like Claude AI , am I right ?

I was not aware of the QTChart abilities QtQuick 2.0  QtCharts 2.0
I was doing my own charts drawing.
So this is a nice  feature to know.  
For some reason after running the code, I see only 1 chart not 2  charts ??

It is using:
system("ring Curl-Get-HIS-NASD-100.ring")

Can I pass parameters to tell it  things like
     Filename         ( to save as, or read from)
     quotes.ini        (file that has all 100 stocks to use)
     Interval  1mo   (fetch 1 month intervals og data )
     Range    5y       ( fetch 5 years worth of data  =>  60 months)

    cUrl = "https://query1.finance.yahoo.com/v8/finance/chart/" + cSymbol + "?interval=1mo&range=5y" 

The AI code has a BUG when the stock has 42 or 50 months of data and not the full 60 months
It doesn't realign (shift to right)  the data so that the most current month is on the right,

For my performance calculations for good results on the 100 stocks
Compare  this month price to  price 7 months ago
Buy the Top 7 stocks => TOT  
Compare to QQQ 

Can you ask the AI to the calc and compare using  the above ?

List of the 100 NASD Stocks
aStocks = ["QQQ","AAPL","ABNB","ADBE","ADI","ADP","ADSK","AEP","AMAT","AMD","AMGN","AMZN","APP","ARM","ASML","AVGO","AXON","AZN","BIIB","BKNG","BKR","CCEP","CDNS","CDW","CEG","CHTR","CMCSA","COST","CPRT","CRWD","CSCO","CSGP","CSX","CTAS","CTSH","DASH","DDOG","DXCM","EA","EXC","FANG","FAST","FTNT","GEHC","GFS","GILD","GOOGL","HON","IDXX","INTC","INTU","ISRG","KDP","KHC","KLAC","LIN","LRCX","LULU","MAR","MCHP","MDLZ","MELI","META","MNST","MRVL","MSFT","MSTR","MU","NFLX","NXPI","ODFL","ON","ORLY","PANW","PAYX","PCAR","PDD","PEP","PLTR","PYPL","QCOM","REGN","ROP","ROST","SBUX","SHOP","SNPS","TEAM","TMUS","TRI","TSLA","TTD","TTWO","TXN","VRSK","VRTX","WBD","WDAY","XEL","ZS"]

Message has been deleted

Azzeddine Remmal

unread,
Nov 30, 2025, 4:43:10 PM (8 days ago) Nov 30
to The Ring Programming Language
Hello Bert, 

I was looking at the AI generated code.
Looks like Claude AI , am I right ?

I only write the code by hand when I'm offline. 
As for the llms (Gemini), it's not important because I deal with them professionally
I don't send requests like that. I use contextual engineering with them.

See the attached application.
Capture12.PNG

Regards, Azzeddine
backend.ring
quotes.ini
main.ring
chart_widget.ring

Bert Mariani

unread,
Nov 30, 2025, 7:19:44 PM (8 days ago) Nov 30
to The Ring Programming Language
Hello Azzeddine

You wrote this in about ~ 5 hours after responding to my email.
Man am I impressed with your Speed and Coding  !!
Quick Results in Little Time !!

Best Regards
Bert Mariani 

Mahmoud Fayed

unread,
Nov 30, 2025, 10:17:45 PM (7 days ago) Nov 30
to The Ring Programming Language
Hello Azzeddine

Thanks for sharing :D


Also, Added to Ring website (News section & Resources page)

ringnews.png

Greetings,
Mahmoud

Azzeddine Remmal

unread,
Dec 1, 2025, 3:36:35 AM (7 days ago) Dec 1
to The Ring Programming Language
Hello Mahmoud

Thank you for your help in setting up the app and posting in the latest news section.

Regards, Azzeddine

The Future of Programming

unread,
Dec 1, 2025, 4:02:57 AM (7 days ago) Dec 1
to The Ring Programming Language
Hello Azzeddine

You are welcome :D

Greetings, 
Mahmoud

--

---
You received this message because you are subscribed to the Google Groups "The Ring Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ring-lang+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ring-lang/6280e52d-5f8a-4750-8713-b62f0c99aa21n%40googlegroups.com.

Mahmoud Fayed

unread,
Dec 1, 2025, 11:45:00 PM (6 days ago) Dec 1
to The Ring Programming Language
Hello 

Now we have a package for the Stock Analysis application by our friend Azzeddine

* Install

ringpm install stockanalysis from ringpackages

* Run

ringpm run stockanalysis

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Dec 2, 2025, 6:31:10 PM (6 days ago) Dec 2
to The Ring Programming Language
Hello Bert, Azzeddine

The StockAnalysis application is updated to use QProcess, remove() and avoid System() function
This provides too much better performance

Also, the StockAnalysis package is updated to include these changes 

Greetings,
Mahmoud

Mansour Ayouni

unread,
Dec 2, 2025, 6:35:19 PM (6 days ago) Dec 2
to Mahmoud Fayed, The Ring Programming Language
Hello Mahmoud,

I also use system() calls to run external tools in Softanza (Graphiz Dot.exe, Python.exe, etc).
Is QProcess() better for this case?

Best,
Mansour

--

---
You received this message because you are subscribed to the Google Groups "The Ring Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ring-lang+...@googlegroups.com.

Mahmoud Fayed

unread,
Dec 2, 2025, 7:11:54 PM (6 days ago) Dec 2
to The Ring Programming Language
Hello Mansour

>> "Is QProcess() better for this case?"

Yes, it's faster and avoid showing the terminal/command prompt window when executing commands from GUI apps

Also, QProcess is part of QtCore (Doesn't requires the other Qt modules)
So, it can be used after load "qtcore.ring" i.e. it's not necessary to use load "guilib.ring"

Greetings,
Mahmoud

Mansour Ayouni

unread,
Dec 2, 2025, 7:15:21 PM (6 days ago) Dec 2
to Mahmoud Fayed, The Ring Programming Language
Thank you very much Mahmoud!
Best,
Mansour

Mahmoud Fayed

unread,
Dec 2, 2025, 7:16:18 PM (6 days ago) Dec 2
to The Ring Programming Language
Hello Mansour

You are welcome :D

Greetings,
Mahmoud

Bert Mariani

unread,
Dec 3, 2025, 9:42:08 AM (5 days ago) Dec 3
to The Ring Programming Language
Hello Mahmoud

RE: "use QProcess , remove() and avoid System() function"

Thanks for the update.
Make more sense !

Best Regards
Bert Mariani

Bert Mariani

unread,
Dec 3, 2025, 10:38:49 AM (5 days ago) Dec 3
to The Ring Programming Language
Hello Azzeddine

I get different Performance results compared to your program.
    Run  
    -  Curl-Get-HIS-NASD-100.ring   which calls  
    -   YearlyReturns.ring   which calculates ad draws the chart

I get  QQQ: 1.67  vs  TOT: 4.05

See attached CSV files.
     - AAA-CompareResult.csv
     - AAA-CompareResult-Bert.csv

I generate the performance for every Stock based on  
      -  Change of price for  (current  Month)   /   (Month-7 )  for each and every month
      -  Sort by Top 7 results for each and every month
      -  Average out the Result / 7   => TOT for that month
      -  See spreadsheet


==========================
These are the routines

        ReadCSVFile()       // aList = csvfile
        CreateLists()       // tList with Symbol
        CalcPerformance()   // pList
        SortPerformance()   // sList => nList Name
        GenerateRank()      // rList
        BuyRank()           // bList = Price in nCol if Rank <= Top10
        CalcGain()          // gList = Gain = Buy at nCol See at nCol +1
        MonthlyGain()       // mList = Avg Gain for each nCol
        Compounding()       // cList = Compoud gains by Periods
        SummaryStock()      // Stock Compunded
        SummaryTotal()      // Total Top10 Compounded vs QQQ
        ShowTop10()         // Show last top10 Symbols


=========================
Performance Charts

CompareChart-Bert-Snap2.png

CompareChart-Azzeddine-Snap1.png

AAA-CompareResult-Bert.csv
AAA-CompareResult.csv
Curl-Get-HIS-NASD-100.ring
YearlyReturns.ring

Azzeddine Remmal

unread,
Dec 3, 2025, 3:21:45 PM (5 days ago) Dec 3
to The Ring Programming Language
Hello Bert

Please don't send me back to the stock market and forex. 
I've tried everything: classical analysis, indicators, even Japanese candlesticks in my dreams.

Do you know that I discovered Ring while desperately trying to program an expert for the stock market and forex? Then one day in 2017, I asked Mahmoud for his opinion, and he advised me: "Providing added value to society is better than a program that buys and sells money." I abandoned it after that. Anyway, the program is right there in front of you modify it as you see fit. 

Regards, Azzeddine

Bert Mariani

unread,
Dec 3, 2025, 3:57:33 PM (5 days ago) Dec 3
to The Ring Programming Language
Hello Azzeddine

Thanks for sharing your story.  :D

I had written a Stock program in  C++ back in 1991. and kept it  current ever since.
Based on my theory of buying the best performing stocks as per my algorithm.

When I came across Ring ...
I wanted to see it could do two things easily.
   - Can it Download Data from the Internet - Prices and Dividends
   - Can it Draw a Chart of those Stock Prices and Dividends
Answer
    - Yes it can - Easily !!
    - Since then I have written Ring programs  on a variety of topics of interest.

I still use and prefer my C++ program
For Speed and Data Structures.

Yes. I can modify your code.
But I figured that you can do it quicker  :D

C++ program Ranking by Decile Performance of the NASD 100
Weekly basis for last 7 years of data.

C--Ranking-Deciles-Snap1.png

Best Regards
Bert Mariani

Mansour Ayouni

unread,
Dec 3, 2025, 4:00:37 PM (5 days ago) Dec 3
to Bert Mariani, The Ring Programming Language
Hello Bert and Azzedine,
Thank you both for these nice stories.
All the best,
Mansour

Reply all
Reply to author
Forward
0 new messages