Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2007
    Messaggi
    14

    Che cosa ne pensate di questo programma C che dimostra come vincere col trading?

    #include <string.h>
    #include <stdlib.h>

    int main(int argc, char** argv) {
    double amount;
    double target;
    int winperc;
    int changeperc = 10;
    int whichcase;
    int howmuch;
    int volatil = 5;
    int limvolatil = 4;
    int count = 0;
    double invest;
    int inverti = 1;

    if (argc < 3) {
    printf("\nHow many operations do you need to loose all your money? This program demonstrates the secret Gold Rule of Trading (aka: why some good investors loose all their money): Every time you have a big loss you should decrease the investment to ricuperate the capital and every time you have a big win you should increase it. The people usually do the opposite!\n");
    printf("\nforex [capital] [target capital] [winning percentage] [invert]\n\n");
    printf("(winning percentage = how many times you win every 100; invert = 0 to follow the gold rule and 1 to not follow it)\n");
    printf("\nexample. forex 50 100 60 1\n\n");
    printf("What you will discover? You will discover every time you don't follow the Gold Rule (invert=1) you lose all your money and every time you follow it (invert=0) you reach your capital target\nGood look people!\n");

    printf("\n__Cyber_traveller__\n\n");
    exit(1);
    }

    inverti = atoi(argv[4]);
    amount = atoi(argv[1]);
    target = atoi(argv[2]);
    winperc = atoi(argv[3]);
    //changeperc = argv[4];
    //volatil = argv[5];

    srand ( time(NULL) );

    invest = amount;

    do {
    count++;

    whichcase = rand() % 100 + 1;
    howmuch = rand() % volatil;

    if (whichcase <= winperc)
    {
    if (inverti == 0) {
    if (howmuch >= limvolatil) {
    if (invest < (amount * 3))
    invest = invest + ((invest / 100) * changeperc);

    printf(" Grossa vincita\n");
    }
    } else {
    if (howmuch >= limvolatil) {
    if (invest > (amount /8))
    invest = invest - ((invest / 100) * changeperc);

    printf(" Grossa vincita\n");
    }
    }


    amount = amount + ((invest/100) * howmuch);

    }
    else
    {
    if (inverti == 0) {
    if (howmuch >= limvolatil) {
    if (invest > (amount /8))
    invest = invest - ((invest / 100) * changeperc);

    printf(" Grossa perdita\n");
    }
    } else {
    if (howmuch >= limvolatil) {
    if (invest < (amount * 3))
    invest = invest + ((invest / 100) * changeperc);

    printf(" Grossa perdita\n");
    }
    }

    amount = amount - ((invest/100) * howmuch);
    }

    printf("amount =<%f> - investment= <%f>\n", amount, invest);


    } while ((amount > (double)1) && (amount < (double)target));


    printf("----------------------\nOperations = <%i>\n", count);

    return 0;
    }

  2. #2
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480
    Ma cosa ne dovremmo pensare?

    Il tuo problema "tecnico" di programmazione qual è?

    Se non c'è, allora sei OT ...
    No MP tecnici (non rispondo nemmeno!), usa il forum.

  3. #3
    Moderatore di Programmazione L'avatar di alka
    Registrato dal
    Oct 2001
    residenza
    Reggio Emilia
    Messaggi
    24,472

    Moderazione

    Originariamente inviato da yucos
    Che cosa ne pensate di questo programma C che dimostra come vincere col trading?
    Che non è un problema di cui ci occupiamo qui...

    Se hai un problema legato alla programmazione in C, apri una discussione seguendo le norme del Regolamento e spieghi qual è così possiamo vedere come darti una mano, altrimenti lascia perdere.
    MARCO BREVEGLIERI
    Software and Web Developer, Teacher and Consultant

    Home | Blog | Delphi Podcast | Twitch | Altro...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.