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";
}