Previous Next


Calculates and draws the current Chance-Risk-Value on the chart.

void  GTrade.CalculateCRV();


This function requires lines with the names "StopLoss", "TakeProfit" and optionally "Pending" to perform the calculations. These are automatically found when using the function GTrade.ChartEvent()


//--- Include Glib classes
#include <Glib.mqh>

//--- Generation of a pointer to an empty class object
GTrade *trade;

int OnInit ()
   //--- Assign the class to the empty class object
   trade = gTrade();

   //--- Initialize the class data

   //--- Add a trade button


void OnDeinit (const int reason)
   //--- Free up memory on exit
   delete trade;

void OnTick ()
   //--- For existing lines, display CRV automatically

void OnChartEvent (const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
      //--- Use ChartEvents of the class
      trade.ChartEvent(id, lparam, dparam, sparam);

See also