|
|
@@ -212,6 +212,7 @@ void OnTimer()
|
|
|
{
|
|
|
gmtDifference = (int)TimeCurrent() - (int)TimeGMT();
|
|
|
read_history_file();
|
|
|
+
|
|
|
readData();
|
|
|
writeDataClientCof();
|
|
|
}
|
|
|
@@ -769,6 +770,7 @@ void readData()
|
|
|
{
|
|
|
for(int i=0; i<ArraySize(order_array); i++)
|
|
|
{
|
|
|
+ //Print(" ------------------------------------------ Ticket: ", order_array[ArraySize(order_array)-1].ticket, " Magic Number: ", order_array[ArraySize(order_array)-1].magicNo, " Array Size: ", ArraySize(order_array), " Index: ", i);
|
|
|
int trade_taken = 2;
|
|
|
int partialCloseOrderPosition=-1;
|
|
|
for(int j=0; j<orderCount; j++)
|
|
|
@@ -850,7 +852,7 @@ void readData()
|
|
|
{
|
|
|
if(addOrderMaster(trade.ResultOrder(),order_array[i].ticket,order_array[i].lots, "Market"))
|
|
|
{
|
|
|
- Print("Order Ticket:",trade.ResultOrder()," Stored!!!");
|
|
|
+ Print(" Buy Order Ticket:",trade.ResultOrder()," Stored!!!");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -877,7 +879,7 @@ void readData()
|
|
|
{
|
|
|
if(addOrderMaster(trade.ResultOrder(),order_array[i].ticket,order_array[i].lots, "Market"))
|
|
|
{
|
|
|
- Print("Order Ticket:",trade.ResultOrder()," Stored!!!");
|
|
|
+ Print(" Sell Order Ticket:",trade.ResultOrder()," Stored!!!");
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
@@ -964,16 +966,15 @@ void readData()
|
|
|
bool trade_close = true;
|
|
|
if(PositionSelectByTicket(cod[i].ticket))
|
|
|
{
|
|
|
-
|
|
|
for(int j=0; j<ArraySize(order_array); j++)
|
|
|
{
|
|
|
if(cod[i].magic == (order_array[j].ticket))
|
|
|
{
|
|
|
-
|
|
|
+ int digitss = getDoubleSymbolInfo(PositionGetString(POSITION_SYMBOL), "digits");
|
|
|
trade_close = false;
|
|
|
- if(PositionGetDouble(POSITION_TP)!=order_array[j].takeprofit || PositionGetDouble(POSITION_SL)!=order_array[j].stoploss)
|
|
|
+ // if(PositionGetDouble(POSITION_TP)!=order_array[j].takeprofit || PositionGetDouble(POSITION_SL)!=order_array[j].stoploss)
|
|
|
+ if(NormalizeDouble(cod[i].takeprofit, digitss) != order_array[j].takeprofit || NormalizeDouble(cod[i].stoploss, digitss) != order_array[j].stoploss)
|
|
|
{
|
|
|
-
|
|
|
if(trade.PositionModify(PositionGetInteger(POSITION_TICKET),order_array[j].stoploss,order_array[j].takeprofit))
|
|
|
{
|
|
|
Print("Order modified ticket:",PositionGetInteger(POSITION_TICKET));
|