How do you set up strings and int so you can change them and send it thru a process repeatedly, without replecating the code again and again

So this is simplified code, it was fetching prices of stocks and displaying it to a LCD. I've trimmed it down here to display the basic code. It sets up the screen, declares the API, fetches the price and then shoots it to the screen. (A NodeMCU and a serial 4x20LCD display.)
My original code does 7 stock codes and ive got the code repeated for each stock. its long and repetitive. There is also a few other things I need to do, also repetitive. I've written that code too, but its getting ridiculous.

How do I setup the arduino code to set up a stock code, send it thru the works, and then change to a new stock code and do it again. The price fetch parsing is the same for each stock as it gets it from the same website so that's no problem. I tried setting up a non constant string, and etc, but i was only able to change the stock code name sent to the screen and couldn't even a start on how to instruct it to handle the price, which of course keeps changing. I do hope someone understands what I'm searching for.
I used "String CODE[3];" and set it for the first stock code but getting the rest to work is not my area.

Can anyone help?
Is this getting too complex for the IDE? I may have to do this is Phython, but I dont know Python.

#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <ESP8266HTTPClient.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);


char* ssid = "ASIO VAN 5";
char* password = "password5";
const char* host = "api.thingspeak.com";
const int httpPortRead = 80;
const char* url2 = "/apps/thinghttp/send_request?api_key=WFE5LU8FHWNR4M25";   //AEF

int To_remove;
String Amount, Increase, Ratio, Data_Raw, Data_Raw_1, AEF;

WiFiClient client;
HTTPClient http;

char input;

void setup() {
  Serial.begin(9600);
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();             //Disconnect and reconnect to the Wifi you set
  delay(1000);
  WiFi.begin(ssid, password);

  if (WiFi.status() != WL_CONNECTED)    //In case the Wifi connection is lost
  {
    delay(1500);
    WiFi.begin(ssid, password);
    Serial.println("Reconnecting to WiFi..");
  }

  //Use predefined PINS consts
  Wire.begin();
  lcd.init();
  lcd.noBacklight();
  lcd.home();
  delay(2000);
  lcd.setCursor(0, 0);               // set cursor to 2nd position on line 2
  // write heart character stored in byte[1]
  lcd.print("Reconnecting to WiFi..");
  delay(500);
  lcd.backlight();
}
String titil;
String inputString;
void loop() {
  getprices();
  lcd.setCursor(0, 0);

  delay(2000);
  lcd.clear();
  lcd.setCursor(0, 1);              // set cursor to 0th position on line 3
  lcd.print("AEF $");

  lcd.setCursor(10, 1);              // set cursor to 6th position on line 4
  lcd.print(AEF);

  delay(2000);
}

void stock_AEF() {

  if (http.begin(host, httpPortRead, url2)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string

        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf(" ");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);                     //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);

        To_remove = Data_Raw_1.indexOf("<");                     //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        AEF = Data_Raw_1;

      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
    }
    http.end();
  }
}

void getprices () {

  stock_AEF();
  titil = "AEF";

}

I should add I could use a For loop and do the price fetching under each loop in the for loop but Im not understanding how to declare the information variable and the syntax to handle the stock codes and store the price. It wouldn't have to store each price, only while its fetching it and displaying it and then it can forget it.

are you able to simplify the code much shorter? so that I see what you really need.
write an example:
I have some thing like this "........"
I want at the end it appear so "......"

the request you build http://api.thingspeak.com//apps/thinghttp/send_request?api_key=WFE5LU8FHWNR4M25 does return the Australian Ethical Investment stock price, without anything special

what parsing do you need?

Moved to a more appropriate section of the forum.

Store the stock symbol and corresponding api key in an array, then pass the array element to functions for retrieving the stock price and displaying on the LCD. You would preferably need to build the API request from the base "/apps/thinghttp/send_request?api_key=" by appending the api key, since saving the entire API request for each stock would be very wasteful of memory.

Something like this for the array of stocks:

struct stocks_ {
  const char text[5];
  const char apiKey[17];
} stocks[] = {
  {"AEF", "WFE5LU8FHWNR4M25"},  //AEF
  {"MSFT", "WFE5LU8FHWNR4M25"}, //Microsoft, fake API key
};

I think you've shortened/simplified it a little too much. We can't see the repetition!

Another approach, beside using arrays, is to pass all the values that are unique to each stock as parameters to a function. Those would include things like the stock title and the row and column on the LCD where the value is to be printed.

Hi Paul, Yes Ive over simplified it to demonstrate. Here is the whole code. (yes its huge)

#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <ESP8266HTTPClient.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);


float rsi = 30;
float macd = -0.10;

float sellrsi = 80;
float sellmacd = 0.20;


// or

char* ssid = "ASIO VAN 5";
char* password = "monday11";
const char* host = "api.thingspeak.com";
const int httpPortRead = 80;
unsigned long int x;

const char* url2 = "/apps/thinghttp/send_request?api_key=WFE5LU8FHWNR4M25";   //AEF
const char* url3 = "/apps/thinghttp/send_request?api_key=8U0AYADPRWHO6WED";   //AEFMACD
const char* url4 = "/apps/thinghttp/send_request?api_key=3OH4676B0O7HWKMP";   //AEFRSI

const char* url5 = "/apps/thinghttp/send_request?api_key=WX6QSEQRN7CQCT99";   //GMG
const char* url6 = "/apps/thinghttp/send_request?api_key=54DNBFCZENAPDCFR";   //GMGMACD
const char* url7 = "/apps/thinghttp/send_request?api_key=A6ESWGDQ40FQVNPY";   //GMGRSI

const char* url8 = "/apps/thinghttp/send_request?api_key=J6K1YY2AGOER3F8K";   //WEB
const char* url9 = "/apps/thinghttp/send_request?api_key=TBGPGRUQF7K9T7GY";   //WEBMACD
const char* url10 = "/apps/thinghttp/send_request?api_key=YMC6T85B8U5E1F4V";   //WEBRSI

const char* url11 = "/apps/thinghttp/send_request?api_key=GZKSG2K72QXLD1I6";   //STO
const char* url12 = "/apps/thinghttp/send_request?api_key=6APTFUUS620A0VBR";   //STOMACD
const char* url13 = "/apps/thinghttp/send_request?api_key=BKBRFPG5VNOI23IW";   //STORSI

const char* url14 = "/apps/thinghttp/send_request?api_key=OEK4FM7KVQP25QRA";   //MFGRSI
const char* url15 = "/apps/thinghttp/send_request?api_key=0WO1G56SBQ8YJR5W";   //MFGMACD
const char* url16 = "/apps/thinghttp/send_request?api_key=IWGYZRNSDCKBBM1E";   //MFGRSI

const char* url17 = "/apps/thinghttp/send_request?api_key=ZLDMAR56RLQ00HZ4";   //QAN
const char* url18 = "/apps/thinghttp/send_request?api_key=0MSP4S56VPSSTB7K";   //QANMACD
const char* url19 = "/apps/thinghttp/send_request?api_key=PX2MXGHHP9CM7T2I";   //QANRSI

const char* url20 = "/apps/thinghttp/send_request?api_key=50PUXBNVYH3PHEL7";   //IPL
const char* url21 = "/apps/thinghttp/send_request?api_key=6PYYMYLYMFQVVGZR";   //IPLMACD
const char* url22 = "/apps/thinghttp/send_request?api_key=05ZEQA4XECS2XB5O";   //IPLRSI

const char* url23 = "/apps/thinghttp/send_request?api_key=Q40MSE42P97XOHLU";   //CPU
const char* url24 = "/apps/thinghttp/send_request?api_key=4TMB0P4HW9UP351U";   //CPUMACD
const char* url25 = "/apps/thinghttp/send_request?api_key=1EDWNSOX3V22JE0X";   //CPURSI

const char* url26 = "/apps/thinghttp/send_request?api_key=64XS3R5IQWDKQQUA";   //BPT
const char* url27 = "/apps/thinghttp/send_request?api_key=2588BYEDOMYY9UQ8";   //BPTMACD
const char* url28 = "/apps/thinghttp/send_request?api_key=FNE3F7JCBY3Z1N57";   //BPTRSI



int To_remove, aefmacdbuy, aefrsibuy, wowmacdbuy, wowrsibuy, gmgmacdbuy, gmgrsibuy, webmacdbuy, webrsibuy, stomacdbuy, storsibuy, mfgmacdbuy, mfgrsibuy, qanmacdbuy, qanrsibuy, iplmacdbuy, iplrsibuy, cpumacdbuy, cpursibuy;
int bptmacdbuy, bptrsibuy;
int aefmacdsell, aefrsisell, wowmacdsell, wowrsisell, gmgmacdsell, gmgrsisell, webmacdsell, webrsisell, stomacdsell, storsisell, mfgmacdsell, mfgrsisell, qanmacdsell, qanrsisell, iplmacdsell, iplrsisell, cpumacdsell, cpursisell;
int bptmacdsell, bptrsisell;
String Amount, Increase, Ratio, Data_Raw, Data_Raw_1, Data_Raw_2, Data_Raw_3;

WiFiClient client;
HTTPClient http;

char input;
unsigned long int lasttime, timesup;

String AEF, GMG, WEB, STO, MFG, QAN, IPL, CPU, BPT, AEFMACD, AEFRSI, GMGMACD, GMGRSI, WEBMACD, WEBRSI, STOMACD, STORSI, MFGMACD, MFGRSI, QANMACD, QANRSI, IPLMACD, IPLRSI, CPUMACD, CPURSI, BPTMACD, BPTRSI;

void setup() {
  Serial.begin(9600);
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();             //Disconnect and reconnect to the Wifi you set
  delay(1000);
  WiFi.begin(ssid, password);

  if (WiFi.status() != WL_CONNECTED)    //In case the Wifi connection is lost
  {
    delay(1500);
    WiFi.begin(ssid, password);
    Serial.println("Reconnecting to WiFi..");
  }

  //Use predefined PINS consts
  Wire.begin();
  lcd.init();
  lcd.noBacklight();
  lcd.home();
  delay(2000);
  lcd.setCursor(0, 0);               // set cursor to 2nd position on line 2
  // write heart character stored in byte[1]
  lcd.print("Reconnecting to WiFi..");
  delay(500);

  lcd.backlight();
}
String titil;
String inputString;
void loop() {

  x = x + 1 ;

  if ( x == 1 ) {   // get prices first time only
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("getting prices....");
    delay(5000);
    getprices();
  }


  lcd.setCursor(0, 0);
  if (STO == 0 ) {
    getprices();
    lcd.clear();
    lcd.print("getting prices again...");
  }

  if ( x >= 90 ) {   //327 for an hour approx    // this is so getprices only happens every hour or so so not to swammp the website
    getprices();
    timesup = ((millis()) - lasttime) / 1000;
    lasttime = (millis());
    //Serial.print("loop time was ");
    Serial.print(timesup);
    Serial.println(" seconds");
    x = 1;  // reset x so getprices happens about hourly

  }


  delay(2000);

  lcd.clear();

  lcd.setCursor(0, 1);              // set cursor to 0th position on line 3
  lcd.print("AEF $");

  lcd.setCursor(10, 1);              // set cursor to 6th position on line 4
  lcd.print(AEF);

  lcd.setCursor(0, 2);
  lcd.print("AEFMACD");

  lcd.setCursor(10, 2);
  lcd.print(AEFMACD);

  lcd.setCursor(0, 3);
  lcd.print("AEFRSI");

  lcd.setCursor(10, 3);
  lcd.print(AEFRSI);

  if (aefmacdbuy == 1) {
    if (aefrsibuy == 1) {
      lcd.setCursor(15, 3);
      lcd.print("BUY");
    }
  }

  if (aefmacdsell == 1) {
    if (aefrsisell == 1) {
      lcd.setCursor(15, 3);
      lcd.print("SELL");
    }
  }

  delay(2000);
  lcd.clear();

  lcd.setCursor(0, 1);              // set cursor to 0th position on line 3
  lcd.print("GMG $");

  lcd.setCursor(10, 1);              // set cursor to 6th position on line 4
  lcd.print(GMG);

  lcd.setCursor(0, 2);
  lcd.print("GMGMACD");

  lcd.setCursor(10, 2);
  lcd.print(GMGMACD);

  lcd.setCursor(0, 3);
  lcd.print("GMGRSI");

  lcd.setCursor(10, 3);
  lcd.print(GMGRSI);

  if (gmgmacdbuy == 1) {
    if (gmgrsibuy == 1) {
      lcd.setCursor(15, 3);
      lcd.print("BUY");
    }
  }

  if (gmgmacdsell == 1) {
    if (gmgrsisell == 1) {
      lcd.setCursor(15, 3);
      lcd.print("SELL");
    }
  }

  delay(2000);
  lcd.clear();

  lcd.setCursor(0, 1);              // set cursor to 0th position on line 3
  lcd.print("WEB $");

  lcd.setCursor(10, 1);              // set cursor to 6th position on line 4
  lcd.print(WEB);

  lcd.setCursor(0, 2);
  lcd.print("WEBMACD");

  lcd.setCursor(10, 2);
  lcd.print(WEBMACD);

  lcd.setCursor(0, 3);
  lcd.print("WEBRSI");

  lcd.setCursor(10, 3);
  lcd.print(WEBRSI);

  if (webmacdbuy == 1) {
    if (webrsibuy == 1) {
      lcd.setCursor(15, 3);
      lcd.print("BUY");
    }
  }
  if (webmacdsell == 1) {
    if (webrsisell == 1) {
      lcd.setCursor(15, 3);
      lcd.print("SELL");
    }
  }
  delay(2000);

  lcd.clear();

  lcd.setCursor(0, 1);              // set cursor to 0th position on line 3
  lcd.print("STO $");

  lcd.setCursor(10, 1);              // set cursor to 6th position on line 4
  lcd.print(STO);

  lcd.setCursor(0, 2);
  lcd.print("STOMACD");

  lcd.setCursor(10, 2);
  lcd.print(STOMACD);

  lcd.setCursor(0, 3);
  lcd.print("STORSI");

  lcd.setCursor(10, 3);
  lcd.print(STORSI);

  if (stomacdbuy == 1) {
    if (storsibuy == 1) {
      lcd.setCursor(15, 3);
      lcd.print("BUY");
    }
  }
  if (stomacdsell == 1) {
    if (storsisell == 1) {
      lcd.setCursor(16, 3);
      lcd.print("SELL");
    }
  }
  delay(2000);

  lcd.clear();

  lcd.setCursor(0, 1);              // set cursor to 0th position on line 3
  lcd.print("MFG $");

  lcd.setCursor(10, 1);              // set cursor to 6th position on line 4
  lcd.print(MFG);

  lcd.setCursor(0, 2);
  lcd.print("MFGMACD");

  lcd.setCursor(10, 2);
  lcd.print(MFGMACD);

  lcd.setCursor(0, 3);
  lcd.print("MFGRSI");

  lcd.setCursor(10, 3);
  lcd.print(MFGRSI);

  if (mfgmacdbuy == 1) {
    if (mfgrsibuy == 1) {
      lcd.setCursor(15, 3);
      lcd.print("BUY");
    }
  }
  if (mfgmacdsell == 1) {
    if (mfgrsisell == 1) {
      lcd.setCursor(15, 3);
      lcd.print("SELL");
    }
  }
  delay(2000);

  lcd.clear();

  lcd.setCursor(0, 1);              // set cursor to 0th position on line 3
  lcd.print("QAN $");

  lcd.setCursor(10, 1);              // set cursor to 6th position on line 4
  lcd.print(QAN);

  lcd.setCursor(0, 2);
  lcd.print("QANMACD");

  lcd.setCursor(10, 2);
  lcd.print(QANMACD);

  lcd.setCursor(0, 3);
  lcd.print("QANRSI");

  lcd.setCursor(10, 3);
  lcd.print(QANRSI);

  if (qanmacdbuy == 1) {
    if (qanrsibuy == 1) {
      lcd.setCursor(15, 3);
      lcd.print("BUY");
    }
  }
  if (qanmacdsell == 1) {
    if (qanrsisell == 1) {
      lcd.setCursor(15, 3);
      lcd.print("SELL");
    }
  }
  delay(2000);


  lcd.clear();

  lcd.setCursor(0, 1);              // set cursor to 0th position on line 3
  lcd.print("IPL $");

  lcd.setCursor(10, 1);              // set cursor to 6th position on line 4
  lcd.print(IPL);

  lcd.setCursor(0, 2);
  lcd.print("IPLMACD");

  lcd.setCursor(10, 2);
  lcd.print(IPLMACD);

  lcd.setCursor(0, 3);
  lcd.print("IPLRSI");

  lcd.setCursor(10, 3);
  lcd.print(IPLRSI);

  if (iplmacdbuy == 1) {
    if (iplrsibuy == 1) {
      lcd.setCursor(15, 3);
      lcd.print("BUY");
    }
  }
  if (iplmacdsell == 1) {
    if (iplrsisell == 1) {
      lcd.setCursor(15, 3);
      lcd.print("SELL");
    }
  }

  delay(2000);


  lcd.clear();

  lcd.setCursor(0, 1);              // set cursor to 0th position on line 3
  lcd.print("CPU $");

  lcd.setCursor(10, 1);              // set cursor to 6th position on line 4
  lcd.print(CPU);

  lcd.setCursor(0, 2);
  lcd.print("CPUMACD");

  lcd.setCursor(10, 2);
  lcd.print(CPUMACD);

  lcd.setCursor(0, 3);
  lcd.print("CPURSI");

  lcd.setCursor(10, 3);
  lcd.print(CPURSI);

  if (cpumacdbuy == 1) {
    if (cpursibuy == 1) {
      lcd.setCursor(15, 3);
      lcd.print("BUY");
    }
  }
  if (cpumacdsell == 1) {
    if (cpursisell == 1) {
      lcd.setCursor(15, 3);
      lcd.print("SELL");
    }
  }
  delay(2000);


  lcd.clear();

  lcd.setCursor(0, 1);              // set cursor to 0th position on line 3
  lcd.print("BPT $");

  lcd.setCursor(10, 1);              // set cursor to 6th position on line 4
  lcd.print(BPT);

  lcd.setCursor(0, 2);
  lcd.print("BPTMACD");

  lcd.setCursor(10, 2);
  lcd.print(BPTMACD);

  lcd.setCursor(0, 3);
  lcd.print("BPTRSI");

  lcd.setCursor(10, 3);
  lcd.print(BPTRSI);

  if (bptmacdbuy == 1) {
    if (bptrsibuy == 1) {
      lcd.setCursor(15, 3);
      lcd.print("BUY");
    }
  }

  if (bptmacdsell == 1) {
    if (bptrsisell == 1) {
      lcd.setCursor(15, 3);
      lcd.print("SELL");
    }
  }
  //delay(2000);





}

void stock_AEF() {

  if (http.begin(host, httpPortRead, url2)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string

        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf(" ");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);                     //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);

        To_remove = Data_Raw_1.indexOf("<");                     //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());




        Amount = Data_Raw_1;
        // Serial.print("C: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        AEF = Amount;

      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
    }

    http.end();
  }

}

void stock_AEFMACD() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url3)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string


        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("M");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        AEFMACD = Amount;
        //Serial.print("AEFMACD: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        float aefmacd = Amount.toFloat();
        //Serial.print("float aefmacd = ");
        //Serial.println(aefmacd);
        if ( aefmacd <= -0.24 ) {  // -0.24
          aefmacdbuy = 1;
        }
        if (aefmacd >= 0.20 ) {
          aefmacdsell = 1;
        }
      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}

void stock_AEFRSI() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url4)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string

        //Serial.print(Data_Raw);

        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("R");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        AEFRSI = Amount;
        //Serial.print("AEFRSI: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        float aefrsi = Amount.toFloat();

        AEFRSI = String(aefrsi);
        if (aefrsi <= 30.0) {  //30
          aefrsibuy = 1;
        } if (aefrsi >= 70.0) { //30
          aefrsisell = 1;
        }

      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}



void stock_GMG() {

  if (http.begin(host, httpPortRead, url5)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string


        Data_Raw_1 = Data_Raw;
        //Serial.print(Data_Raw);
        To_remove = Data_Raw_1.indexOf(" ");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);                     //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);

        To_remove = Data_Raw_1.indexOf("<");                     //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        //Serial.print("C: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        GMG = Amount;

      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
    }

    http.end();
  }

}

void stock_GMGMACD() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url6)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string


        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("M");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        GMGMACD = Amount;
        //Serial.print("GMGMACD: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        float gmgmacd = Amount.toFloat();
        //Serial.print("float gmgmacd = ");
        //Serial.println(gmgmacd);
        if ( gmgmacd <= -0.24 ) {  // -0.24
          gmgmacdbuy = 1;
        }
        if (gmgmacd >= 0.20 ) {
          gmgmacdsell = 1;
        }
      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}

void stock_GMGRSI() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url7)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string

        //Serial.print(Data_Raw);

        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("R");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        GMGRSI = Amount;
        //Serial.print("GMGRSI: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        float gmgrsi = Amount.toFloat();

        GMGRSI = String(gmgrsi);
        if (gmgrsi <= 30.0) {  //30
          gmgrsibuy = 1;
        } if (gmgrsi >= 70.0) { //30
          gmgrsisell = 1;
        }

      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}

void stock_WEB() {

  if (http.begin(host, httpPortRead, url8)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string


        Data_Raw_1 = Data_Raw;
        //Serial.print(Data_Raw);
        To_remove = Data_Raw_1.indexOf(" ");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);                     //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);

        To_remove = Data_Raw_1.indexOf("<");                     //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        //Serial.print("C: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        WEB = Amount;

      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
    }

    http.end();
  }

}

void stock_WEBMACD() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url9)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string


        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("M");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        WEBMACD = Amount;
        //Serial.print("WEBMACD: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        float webmacd = Amount.toFloat();

        if ( webmacd <= -0.10) {  // -0.24
          webmacdbuy = 1;
        }
        if ( webmacd >= 0.20) {  // -0.24
          webmacdsell = 1;
        }
      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}

void stock_WEBRSI() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url10)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string

        //Serial.print(Data_Raw);

        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("R");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        WEBRSI = Amount;
        //Serial.print("WEBRSI: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        float webrsi = Amount.toFloat();
        //Serial.print("float webrsi = ");
        //Serial.println(webrsi);
        WEBRSI = String(webrsi);
        if (webrsi <= 30.0) {  //30
          webrsibuy = 1;
        }
        if (webrsi >= 70.0) {  //30
          webrsisell = 1;
        }
      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}

void stock_STO() {

  if (http.begin(host, httpPortRead, url11)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string


        Data_Raw_1 = Data_Raw;
        //Serial.print(Data_Raw);
        To_remove = Data_Raw_1.indexOf(" ");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);                     //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);

        To_remove = Data_Raw_1.indexOf("<");                     //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        //Serial.print("C: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        STO = Amount;

      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
    }

    http.end();
  }

}

void stock_STOMACD() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url12)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string


        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("M");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        STOMACD = Amount;
        //Serial.print("STOMACD: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        float stomacd = Amount.toFloat();

        if ( stomacd <= -0.20) {  // -0.24
          stomacdbuy = 1;
          
        }
        if ( stomacd >= 0.20) {  // -0.24   -0.072
          stomacdsell = 1;
          Serial.println(stomacd);
        }
      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}

void stock_STORSI() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url13)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string

        //Serial.print(Data_Raw);

        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("R");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        STORSI = Amount;
        //Serial.print("STORSI: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        float storsi = Amount.toFloat();
        //Serial.print("float storsi = ");
        //Serial.println(storsi);
        STORSI = String(storsi);
        if (storsi <= 30.0) {  //30
          storsibuy = 1;
        }

        if (storsi >= 70.0) {  //30
          storsisell = 1;
          Serial.println(storsi);
        }
      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}


void stock_MFG() {

  if (http.begin(host, httpPortRead, url14)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string


        Data_Raw_1 = Data_Raw;
        //Serial.print(Data_Raw);
        To_remove = Data_Raw_1.indexOf(" ");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);                     //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);

        To_remove = Data_Raw_1.indexOf("<");                     //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        //Serial.print("C: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        MFG = Amount;

      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
    }

    http.end();
  }

}

void stock_MFGMACD() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url15)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string


        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("M");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        MFGMACD = Amount;
        //Serial.print("MFGMACD: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        float mfgmacd = Amount.toFloat();
        //Serial.print("float mfgmacd = ");
        //Serial.println(mfgmacd);
        if ( mfgmacd <= -0.21) {  // -0.24
          mfgmacdbuy = 1;
        } if ( mfgmacd >= 0.20) {  // -0.24
          mfgmacdsell = 1;
        }
      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}

void stock_MFGRSI() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url16)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string

        //Serial.print(Data_Raw);

        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("R");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        MFGRSI = Amount;
        // Serial.print("MFGRSI: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        float mfgrsi = Amount.toFloat();
        //Serial.print("float mfgrsi = ");
        //Serial.println(mfgrsi);
        MFGRSI = String(mfgrsi);
        if (mfgrsi <= 30.0) {  //30
          mfgrsibuy = 1;
        }
        if (mfgrsi >= 70.0) {  //30
          mfgrsisell = 1;
        }
      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}


void stock_QAN() {

  if (http.begin(host, httpPortRead, url17)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string


        Data_Raw_1 = Data_Raw;
        //Serial.print(Data_Raw);
        To_remove = Data_Raw_1.indexOf(" ");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);                     //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);

        To_remove = Data_Raw_1.indexOf("<");                     //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        //Serial.print("C: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        QAN = Amount;

      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
    }

    http.end();
  }

}

void stock_QANMACD() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url18)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string


        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("M");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        QANMACD = Amount;
        //Serial.print("QANMACD: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        float qanmacd = Amount.toFloat();

        if ( qanmacd <= -0.21) {  // -0.24
          qanmacdbuy = 1;
        }
        if ( qanmacd >= 0.20) {  // -0.24
          qanmacdsell = 1;
        }
      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}

void stock_QANRSI() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url19)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string

        //Serial.print(Data_Raw);

        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("R");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        QANRSI = Amount;
        //Serial.print("QANRSI: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        float qanrsi = Amount.toFloat();
        //Serial.print("float qanrsi = ");
        //Serial.println(qanrsi);
        QANRSI = String(qanrsi);
        if (qanrsi <= 30.0) {  //30
          qanrsibuy = 1;
        }
        if (qanrsi >= 70.0) {  //30
          qanrsisell = 1;
        }
      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}






void stock_IPL() {

  if (http.begin(host, httpPortRead, url20)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string


        Data_Raw_1 = Data_Raw;
        //Serial.print(Data_Raw);
        To_remove = Data_Raw_1.indexOf(" ");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);                     //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);

        To_remove = Data_Raw_1.indexOf("<");                     //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        //Serial.print("C: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        IPL = Amount;

      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
    }

    http.end();
  }

}

void stock_IPLMACD() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url21)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string


        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("M");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        IPLMACD = Amount;
        //Serial.print("IPLMACD: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        float iplmacd = Amount.toFloat();
        //Serial.print("float iplmacd = ");
        //Serial.println(iplmacd);
        if ( iplmacd <= -0.21) {  // -0.24
          iplmacdbuy = 1;
        }
        if ( iplmacd >= 0.20) {  // -0.24
          iplmacdsell = 1;
        }
      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}

void stock_IPLRSI() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url22)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string

        //Serial.print(Data_Raw);

        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("R");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        IPLRSI = Amount;
        //Serial.print("IPLRSI: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        float iplrsi = Amount.toFloat();
        //Serial.print("float iplrsi = ");
        //Serial.println(iplrsi);
        IPLRSI = String(iplrsi);
        if (iplrsi <= 30.0) {  //30
          iplrsibuy = 1;
        }
        if (iplrsi >= 70.0) {  //30
          iplrsisell = 1;
        }
      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}




void stock_CPU() {

  if (http.begin(host, httpPortRead, url23)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string


        Data_Raw_1 = Data_Raw;
        //Serial.print(Data_Raw);
        To_remove = Data_Raw_1.indexOf(" ");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);                     //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);

        To_remove = Data_Raw_1.indexOf("<");                     //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        //Serial.print("C: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        CPU = Amount;

      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
    }

    http.end();
  }

}

void stock_CPUMACD() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url24)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string


        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("M");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        CPUMACD = Amount;
        //Serial.print("CPUMACD: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        float cpumacd = Amount.toFloat();
        //Serial.print("float cpumacd = ");
        //Serial.println(cpumacd);
        if ( cpumacd <= -0.21) {  // -0.24
          cpumacdbuy = 1;
        }
        if ( cpumacd >= 0.20) {  // -0.24
          cpumacdsell = 1;
        }
      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}

void stock_CPURSI() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url25)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string

        //Serial.print(Data_Raw);

        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("R");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        CPURSI = Amount;
        //Serial.print("CPURSI: ");  //I choosed to display it on the serial monitor to help you debug

        float cpursi = Amount.toFloat();

        CPURSI = String(cpursi);
        if (cpursi <= 30.0) {  //30
          cpursibuy = 1;
        }
        if (cpursi >= 70.0) {  //30
          cpursisell = 1;
        }
      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}


void stock_BPT() {

  if (http.begin(host, httpPortRead, url26)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string


        Data_Raw_1 = Data_Raw;
        //Serial.print(Data_Raw);
        To_remove = Data_Raw_1.indexOf(" ");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);                     //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");                      //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);

        To_remove = Data_Raw_1.indexOf("<");                     //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        //Serial.print("C: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        BPT = Amount;

      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
    }

    http.end();
  }

}

void stock_BPTMACD() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url27)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string


        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("M");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        BPTMACD = Amount;
        //Serial.print("BPTMACD: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        float bptmacd = Amount.toFloat();
        //Serial.print("float bptmacd = ");
        //Serial.println(bptmacd);
        if ( bptmacd <= macd) {  // -0.24
          bptmacdbuy = 1;
          //Serial.print("buy is ");

        }
        if ( bptmacd >= 0.20) {  // -0.24
          bptmacdsell = 1;
        }

      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}

void stock_BPTRSI() {   // this one works on investing.com to get the macd number

  if (http.begin(host, httpPortRead, url28)) {

    int httpCode = http.GET();                //Check feedback if there's a response
    if (httpCode > 0)
    {
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY)
      {

        Data_Raw = http.getString();   //Here we store the raw data string

        //Serial.print(Data_Raw);

        Data_Raw_1 = Data_Raw;
        To_remove = Data_Raw_1.indexOf("R");  //I look for the position number in the string of this symbol "M"
        Data_Raw_1.remove(0, To_remove + 1);  //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before

        To_remove = Data_Raw_1.indexOf(">");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(0, To_remove + 1);      //I remove it and everything that's before


        To_remove = Data_Raw_1.indexOf("</td>");       //I look for the position of this symbol ">"
        Data_Raw_1.remove(To_remove, Data_Raw_1.length());

        Amount = Data_Raw_1;
        BPTRSI = Amount;
        //Serial.print("BPTRSI: ");  //I choosed to display it on the serial monitor to help you debug
        //Serial.println(Amount);
        float bptrsi = Amount.toFloat();
        //Serial.print("float bptrsi = ");
        //Serial.println(bptrsi);
        BPTRSI = String(bptrsi);
        if (bptrsi <= rsi) {  //30
          bptrsibuy = 1;
        }
        if (bptrsi >= 80.0) {  //30
          bptrsisell = 1;
        }
      }
    }
    else //If we can't get data
    {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

    }
    http.end();
  }
}

void getprices () {

  stock_AEF();
  titil = "AEF";

  stock_AEFMACD();
  titil = "AEFMACD";

  stock_AEFRSI();
  titil = "AEFRSI";

  stock_GMG();
  titil = "GMG";

  stock_GMGMACD();
  titil = "GMGMACD";

  stock_GMGRSI();
  titil = "GMGRSI";

  stock_WEB();
  titil = "WEB";

  stock_WEBMACD();
  titil = "WEBMACD";

  stock_WEBRSI();
  titil = "WEBRSI";

  stock_STO();
  titil = "STO";

  stock_STOMACD();
  titil = "STOMACD";

  stock_STORSI();
  titil = "STORSI";

  stock_MFG();
  titil = "MFG";

  stock_MFGMACD();
  titil = "MFGMACD";

  stock_MFGRSI();
  titil = "MFGRSI";

  stock_QAN();
  titil = "QAN";

  stock_QANMACD();
  titil = "QANMACD";

  stock_QANRSI();
  titil = "QANRSI";

  stock_IPL();
  titil = "IPL";

  stock_IPLMACD();
  titil = "IPLMACD";

  stock_IPLRSI();
  titil = "IPLRSI";

  stock_CPU();
  titil = "CPU";

  stock_CPUMACD();
  titil = "CPUMACD";

  stock_CPURSI();
  titil = "CPURSI";

  stock_BPT();
  titil = "BPT";

  stock_BPTMACD();
  titil = "BPTMACD";

  stock_BPTRSI();
  titil = "BPTRSI";



}

Thank you so much for this David, this is exactly the kind of help I think I need. I have not the time to do it now, but later I will try to implement it. Cheers!!

David, how does it work at the retreival end? like in the line of code that calls up the appropriate stock code and API request....how should it look to work properly on the http request line?

ie, this

if (http.begin(host, httpPortRead, url2)) {

should be changed how to implement fetching the correct stock code and api?

What I am trying to say i guess is I understand the concept of the array, and now, how to set up the 10 stock codes in the array, but not the syntax of it at the part which passes the elements of the array thru the function. if that makes sense.

But by oversimplifying, it failed to demonstrate the problem. 3 or 4 stocks would have been enough to demonstrate. Now you show 28?

I'll take a look in the morning.

I greatly changed the struct to include the data needed for each stock, but the basic mechanism is to pass the array element to a function, then build the URL for each stock before sending the http request:

void getStock(stocks_ & stock) {
  char url[sizeof(urlBase) + sizeof(stocks_::apiKey) + 1];
  strcpy(url, urlBase);
  strcat(url, stock.apiKey);

  if (http.begin(host, httpPortRead, url)) {

The struct and urlBase look like this. Note that there is no need to store AEF, AEFMACD, and AEFRSI and similar for every stock, since the latter two can be build from the 3-letter stock symbol.

const char urlBase[] = "/apps/thinghttp/send_request?api_key=";

struct stocks_ {
  const char apiKey[17];
  const char apiKeyMACD[17];
  const char apiKeyRSI[17];
  String price;
  String macd;
  String rsi;
  const char text[4];
  bool buyMACD;
  bool sellMACD;
  bool buyRSI;
  bool sellRSI;
} stocks[] = {
  {"WFE5LU8FHWNR4M25", "8U0AYADPRWHO6WED", "3OH4676B0O7HWKMP", "", "", "", "AEF", false, false, false, false},
  {"WX6QSEQRN7CQCT99", "54DNBFCZENAPDCFR", "A6ESWGDQ40FQVNPY", "", "", "", "GMG", false, false, false, false},
  {"J6K1YY2AGOER3F8K", "TBGPGRUQF7K9T7GY", "YMC6T85B8U5E1F4V", "", "", "", "WEB", false, false, false, false},
  {"GZKSG2K72QXLD1I6", "6APTFUUS620A0VBR", "BKBRFPG5VNOI23IW", "", "", "", "STO", false, false, false, false},
  {"OEK4FM7KVQP25QRA", "0WO1G56SBQ8YJR5W", "IWGYZRNSDCKBBM1E", "", "", "", "MFG", false, false, false, false},
  {"ZLDMAR56RLQ00HZ4", "0MSP4S56VPSSTB7K", "PX2MXGHHP9CM7T2I", "", "", "", "QAN", false, false, false, false},
  {"50PUXBNVYH3PHEL7", "6PYYMYLYMFQVVGZR", "05ZEQA4XECS2XB5O", "", "", "", "IPL", false, false, false, false},
  {"Q40MSE42P97XOHLU", "4TMB0P4HW9UP351U", "1EDWNSOX3V22JE0X", "", "", "", "CPU", false, false, false, false},
  {"64XS3R5IQWDKQQUA", "2588BYEDOMYY9UQ8", "FNE3F7JCBY3Z1N57", "", "", "", "BPT", false, false, false, false},
};

The code for getting the data on all the stocks would then be:

void getprices () {
  for (size_t i = 0; i < sizeof(stocks) / sizeof(stocks[0]); i++) {
    getStock(stocks[i]);
  }
}

The LCD display functions can be done in a similar way.

Also, please edit the code you have posted to remove any actual account names and passwords!!!

ALready edited:)

And thanks for your help!!!! This is amazing work. I will try to get my head around it how it works.
Thanks again

Yes not storing every single one is what I was looking for, however I am having trouble understanding the new setup.

So is struct a declaration before the setup section?

Yes, the struct has to be declared before the code in which it is used.

You might want to try something a little simpler to start with, instead of trying to combine so much into a single struct.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.