Useful features from KimIV - page 60

 

Dear Kim, thank you very much for your work. The functions you've written make my life easier.

Do you have a function in your arsenal that returns the total loss of all consecutive losing trades. Suppose the last three trades were closed at a loss, I want to know the total loss of them in the deposit currency. To clarify - exactly the last consecutive losing trades.

I will be thankful for help. I think others may need this function.

 

KimIV

I tried to plug your functions into the Expert Advisor. The compiler writes the following crap: Function "ClosePositions" is not referenced and will be removed from exp-file

Function "ExistPositions" is not referenced and will be removed from exp-file

Function "ManagePositions" is not referenced and will be removed from exp-file ...........................

What could be the problem?




 
WroC писал(а) >>
The compiler writes: Function "ClosePositions" is not referenced and will be removed from exp-file

What could be the fault?

It's not a bug. It is a warning that the function is not used and therefore there is no sense in compiling its code.

 

Igor!

Are there any developments or just thoughts on time filter functions?

Such as: for the current month, day, week...

or: previous month, day, week, quarter...

*

Ideally, it would look like this:

// FuncStPeriod(int Per, int Val)
// Где:
// Per = 0-день, 1-неделя, и т.д...
// Val = 0-текущие, 1-прошедший

// пример использования для выбора ордеров за период
if(FuncStPeriod(1, 0)) ...

Sorry, but I can see that it doesn't work...

Or maybe I chose the wrong filtering model...

I'm at a standstill... in every sense of the word... :)))

 

You, Vasili, are not politically correct! The entrance is indicated, but where is the exit?

 

I know in my gut that 0.5+0.5 would be a litre!

but I can't solve the problem... (с) )))

*

I would be very grateful for order samples from the history by their timing.

*

And these are:

// FuncStPeriod(int Per, int Val)
// Where:
// Per = 0-day, 1-week, etc..
// Val = 0-current, 1-past


// example of use to select orders for a period
if(FuncStPeriod(1, 0)) ...
*

I wrote it incorrectly, more precisely, without explanation...

The marked parameters are just parameters that the function may have.

Below is an example of how this function is used...

IF THE TIME OF ORDERS IS ALSO (falls within) the FILTER period

...

 

Vasiliy, you're talking about the input again. What do you want at the output and in what form?

 

Ahhhh...

Right, uh... that's where my logical error lies...

The function will return THAT, for example the number 123456

What it needs for the C and PO filter is...

*

In general, it is the same as the account history filter in MT4.

Probably, the list is formed by a cycle, for example:

for( ...

if(Value1 > OrderCloseTime() > Value2)

...

*

This function must return a string (?) value to be substituted into the if() filter

for( ...

if(FuncStPeriod(1, 0))

...

*

Crap. It's complicated in the description...

I got myself mixed up and you are in a bind.

:(

 

Well, you've almost done it yourself! You don't need any filter. Just prepare two datetime values, for example dt1 and dt2. Organize a cycle of closed trades. Select orders by selector and check their closing time to:

if (OrderCloseTime()> dt1 && OrderCloseTime()< dt2) {
  // что-то делаете с выбранным ордером
}
 

Igor" I understand that...

That's how I started to work it out.

*

However, the task is to "fill in" those same dt1 and dt2 with the right values!

For example, quarter, current. In idea, the function should return something like this:

OrderCloseTime()>"01.10.2008" && OrderCloseTime()<"04.12.2008"

Taking today as the starting date.

*

I see the end of FuncStPeriod(int Per, int Val) function as follows:

FuncStPeriod(int Per, int Val)
{
string fsp;

//...
fsp="OrderCloseTime()>"+"dt1+" && OrderCloseTime()<"+dt2;
return(fsp);
}

***

For example "calculating" the number of months back relative to the current one:

int KM()
{
int kolm;
kolm=(TimeLocal()-StrToTime("2007.10.01"))/2592000;
return( kolm-1);
} 

but this simplistic approach has its pitfalls,

which will manifest itself in the fact that it's possible to misidentify

at the beginning of subsequent months...

Reason: