Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools

Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools (http://www.expert-advisor.com/forum/index.php)
-   Codeschnipsel (http://www.expert-advisor.com/forum/forumdisplay.php?f=292)
-   -   RiskRewardDisplay (http://www.expert-advisor.com/forum/showthread.php?t=5863)

Kronenchakra 18.09.17 00:48

RiskRewardDisplay
 
Hallo Leute,
hab mir grad ein Video vom Jim reingezogen, hat mir gefallen und ich hab's abgetippt.
https://www.youtube.com/watch?v=6GaP...ynUKXg&index=3 ab 5:00

Hier der Code:
Code:

#property script_show_inputs

input int inp_SL =  50;    // StopLoss
input int inp_TP = 100;    // TakeProfit

void OnStart()
{
  double ratio  = inp_TP/inp_SL;
  double risk  = inp_SL;
  double reward = inp_TP;
  double total  = risk+reward;
  double prozent= (risk/total)*100;
  string ratio_msg = "The risk reward ratio is: "+DoubleToString(ratio,1)+" : 1\n";
  string prozent_msg = "This means you have to be right "+DoubleToString(prozent,0)+"% of the time.";
  MessageBox(ratio_msg+prozent_msg);
}

Viel Erfolg damit :)


Alle Zeitangaben in WEZ +1. Es ist jetzt 20:11 Uhr.

Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.1
Powered by vBCMS® 2.7.0 ©2002 - 2024 vbdesigns.de
Copyright ©2009 - 2023 by Expert-Advisor.com - Das Metatrader Forum