Hi All,
I have been learning to code for a while by trial and error but have a long way to go. It is very difficult to get understanding involving concepts one has not experienced.
I am hoping someone can provide a breakthrough hint to produce my desired end result as I would really like not only a solution but to come away with new knowledge. I have gotten the following to work:
ordersprofit();
void ordersprofit()
{
profit = 0; pos = 0;
bool TradeDay = True;
while(TradeDay == True)
{
OrderSelect(pos, SELECT_BY_POS);
if(OrderSymbol()==Symbol())
{ profit = profit + OrderProfit();
pos++;
}
else
TradeDay = False;
}
}
The above code outputs the running profit total of an active trade. When the trade closes the total returns to zero.
I would like to modify the above to do the following:
1. Return the cummulative profit total for all closed trades for the current pair for the last 24 hrs starting with a user inputted time.
2. Reset the cummulative profit total to zero at the beginning of the next 24 hr. period and start over again.
3. Set the output variable to 2 decimal points (i.e., 200.00).
Any help would be greatly appreciated. Thanks in advance!
I have been learning to code for a while by trial and error but have a long way to go. It is very difficult to get understanding involving concepts one has not experienced.
I am hoping someone can provide a breakthrough hint to produce my desired end result as I would really like not only a solution but to come away with new knowledge. I have gotten the following to work:
ordersprofit();
void ordersprofit()
{
profit = 0; pos = 0;
bool TradeDay = True;
while(TradeDay == True)
{
OrderSelect(pos, SELECT_BY_POS);
if(OrderSymbol()==Symbol())
{ profit = profit + OrderProfit();
pos++;
}
else
TradeDay = False;
}
}
The above code outputs the running profit total of an active trade. When the trade closes the total returns to zero.
I would like to modify the above to do the following:
1. Return the cummulative profit total for all closed trades for the current pair for the last 24 hrs starting with a user inputted time.
2. Reset the cummulative profit total to zero at the beginning of the next 24 hr. period and start over again.
3. Set the output variable to 2 decimal points (i.e., 200.00).
Any help would be greatly appreciated. Thanks in advance!