void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
{
if(id==CHARTEVENT_OBJECT_CLICK)
{
if(sparam == "Close All Profitable")
{
closingallprofitable();
closingallprofitable();
closingallprofitable();
}
if(sparam == "Buy YM")
{
Alert(sparam+ " was pressed ");
trade.Buy(contracts,"YM_Z",0,0,0,NULL);
}
if(sparam == "Sell YM")
{
Alert(sparam+ " was pressed ");
trade.Sell(contracts,"YM_Z",0,0,0,NULL);
}
//---------------------------------------------------------------
if(sparam == "Buy ES")
{
Alert(sparam+ " was pressed ");
trade.Buy(contracts,"ES_Z",0,0,0,NULL);
}
if(sparam == "Sell ES")
{
Alert(sparam+ " was pressed ");
trade.Sell(contracts,"ES_Z",0,0,0,NULL);
}
//---------------------------------------------------
if(sparam == "Buy NQ")
{
Alert(sparam+ " was pressed ");
trade.Buy(contracts,"NQ_Z",0,0,0,NULL);
}
if(sparam == "Sell NQ")
{
Alert(sparam+ " was pressed ");
trade.Sell(contracts,"NQ_Z",0,0,0,NULL);
}
//------------------------------------------------
if(sparam == "Buy RTY")
{
Alert(sparam+ " was pressed ");
trade.Buy(contracts,"RTY_Z",0,0,0,NULL);
}
if(sparam == "Sell RTY")
{
Alert(sparam+ " was pressed ");
trade.Sell(contracts,"RTY_Z",0,0,0,NULL);
}
//------------------------------------------------
if(sparam == "Buy 6E")
{
Alert(sparam+ " was pressed ");
trade.Buy(contracts,"6E_Z",0,0,0,NULL);
}
if(sparam == "Sell 6E")
{
Alert(sparam+ " was pressed ");
trade.Sell(contracts,"6E_Z",0,0,0,NULL);
}
//--------------------------------------------------
if(sparam == "Buy 6B")
{
Alert(sparam+ " was pressed ");
trade.Buy(contracts,"6B_Z",0,0,0,NULL);
}
if(sparam == "Sell 6B")
{
Alert(sparam+ " was pressed ");
trade.Sell(contracts,"6B_Z",0,0,0,NULL);
}
//--------------------------------------------------
if(sparam == "Buy 6A")
{
Alert(sparam+ " was pressed ");
trade.Buy(contracts,"6A_Z",0,0,0,NULL);
}
if(sparam == "Sell 6A")
{
Alert(sparam+ " was pressed ");
trade.Sell(contracts,"6A_Z",0,0,0,NULL);
}
//--------------------------------------------------
if(sparam == "Buy 6N")
{
Alert(sparam+ " was pressed ");
trade.Buy(contracts,"6N_Z",0,0,0,NULL);
}
if(sparam == "Sell 6N")
{
Alert(sparam+ " was pressed ");
trade.Sell(contracts,"6N_Z",0,0,0,NULL);
}
//--------------------------------------------------
} // if(id==CHARTEVENT_OBJECT_CLICK)
}
//------