Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1085

 

Hello, can you tell me how to calculate the losing orders going in a row? And with a profitable one, the account would be reset to zero. I've invented something, but it's not enough...


int LossOrders()
{
int oldticket;
ticket = 0;

for (i = OrdersHistoryTotal() - 1; i >= 0; i--)
{
if(OrderSelect (i, SELECT_BY_POS, MODE_HISTORY))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == magic)
{
oldticket = OrderTicket();
if (oldticket > ticket)
{
ticket = oldticket;
if(OrderProfit()<0)
{
orderloss++;
}else orderloss=0;
}
}
}
}
return(orderloss);
}

 
Foxonn:
Hello, could you please tell me how to make timestart not static, but dynamic like this D'(timest) 07:00' ?
timets = TimeToString(TimeCurrent(), TIME_DATE);
timestart = D'2016.01.05 07:00';

Like this

string timestart = StringConcatenate(TimeToString(TimeCurrent(), TIME_DATE), " 7:00");


 
AlexeyVik:

It's more or less like this


Thanks so much for the tip, it helped .
 
if
Hi all, I still haven't received a substantive answer, let me ask a different question,is there any way to pass the values of a variable from one if, to another?
 
K_i_r_i_t_o:

Hi all, I still haven't received a substantive answer, I'll ask a different question,is there any way to pass variable values from one if, to another?
Declare them globally, not in one condition. Make them global variables.
 
Foxonn:
Declare them globally, not in one condition. Make them global variables.

It didn't help =) why not, but this solution did not bring any results either
In general, maybe someone knows how to bind an object to the pointer like when drawing a trend line?

Or alternatively is it possible to remove the indicator menu when running it? i.e. to have it as a script immediately on the chart, then the problem would be solved)

 

Afternoon.

In the strategy tester, does the indicator and expert use the same data file (prices)?

 
What function causes the indicator window in the strategy tester to open at the beginning. At the moment the indicator window appears after the visual test is completed.
 
abeiks:

Good afternoon.

In the strategy tester, does the indicator and the Expert Advisor use the same data file (prices)?

Yes

abeiks:
What function to call the opening of the indicator window in the strategy tester at the beginning. At the moment, the indicator window appears after the end of visual testing.

The indicator window in visual mode does not appear at all, if the indicator is called through iCustom or included in a template. Only if it is manually added to the chart.

 
evillive:

Yes

The indicator window in visual mode does not appear at all, if the indicator is called via iCustom or included in a template. Only if it is manually added to the chart.

Thank you.