[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 691

 
artmedia70:
I have no binding to a specific TF - all my estimations are based on values on the first bar. It's just that each TF has its own calculation of target values and closing percentage by total profit.


I also calculate market entry by zero bar - i.e. by price

But I am not going to close on profit - for automatic trading this is the best option, because it is difficult for an automaton to gain experience in "blind trade".

 
IgorM:


i have also calculated market entry by zero bar - i.e. by price

And I am not going to close on profit, because this is the best option for automatic trading, because it is difficult for an automaton to gain experience for "blind trade".

I think, IMHO, of course, that the harder we set for entering the market, the more obvious exit will be... Especially, Igor, for your strategy with only one position in the market.
 
artmedia70:
I think, IMHO of course, that the harder we set the entry into the market, the more obvious the exit will be for us... Especially, Igor, for your strategy where there is only one position in the market.

When I started to open a flat I usually have problems with it, but if I take time to make a decision after an unsuccessful entry I agree - it's too hard for brokerage companies, when I look for an exit I have a real problem - I see it and I know I need to close, but automatic approach is not always successful - I'm looking for it and I know I will find it :)
 
artmedia70:
I was wandering around the forum and came across an interesting idea - to determine divergences not by extremums, but by linear regression and if their comparison is minus it means that a divergence has been found... Even a function was posted there:
Now the only thing that remains is to understand and understand how to work with this miracle... Then I'll put my findings here... If I figure it out... I'm a dummy... :)

What about building trends on an indicator? :)

Of course, one can use regression. By the way, extrema can also be determined by it. However a correct zigzag should be faster than a regression.

In any case, this function must be applied only for a one-time calculation of the regression. If we are talking about continuous calculation of sliding LR (which is exactly what we are talking about), full calculation of sums is done only at the start, after that only their modification is done - i.e. the cycle is not used anymore.

Not much, but a lot has been said on this forum about linear regression :). For example, effective indicators here and here.

 
Candid:

What about building trends on an indicator? :)

Of course, one can use regression. By the way, extrema can also be determined by it. However a correct zigzag should be faster than a regression.

In any case, it makes sense to use this function only for a one-time regression calculation. If we are talking about continuous calculation of sliding LR (which is exactly what we are talking about), full calculation of sums is done only at the start, after that only their modification is done - i.e. the cycle is no longer used.

Not much, but a lot has been said about linear regression on the forum :). For example, effective indicators here and here.

Thank you. I have already thought it over and realized that finding extrema on price and indicator charts will be more universal for my purposes. Further, a ray will need to be drawn in the A/D chart plotting two points of upper/lower extrema and locating the crossing point between the chart and the ray. Based on the direction of the crossing (up/down), assumptions about further price movement can be made... There is only one thing to do - to code it all correctly...

 
IgorM:

I would say I enter the market softly - straight to profit, at flat I have problems with it, but if I have time to make a decision on failed entry - I agree - it's tough in relation to brokerage companies, I have a real problem with exits - I see something to close, but I always fail to do it automatically - I look for it and know I´ll find it :)

If you can drop me a line with your strategy, I'll try to tell you what (MB) solution you need - my head is full of all kinds of ideas - I don't have the time to check them all (just kidding)...

And about hardness/softness - I don't mean "harder entry into the market" - I mean plunging there like ... something ... somewhere ... from ... somewhere :) I meant defining clearer entry criteria. So to speak - to narrow down the framework.

Although we can widen it: stick to one strategy for a flat and another one for a trend.

 
artmedia70:

Although it is possible to extend it: to follow one strategy for a flat, and another for a trend.


It sounds nice, but no one knows when a flat ends and when it starts :) - I'm struggling with this phenomenon and it seems to be working - we'll discuss it later

I would like to control an open order according to the following principle - if after placing an order by closing N bars its profit is less than the set value, then close the order

How can I check/calculate from an EA how many bars ago an order was opened?

 
IgorM:

How do I check/calculate from an EA how many bars ago an order was opened?

The order is passed as a parameter.
It returns the shift to the left relative to the current bar.

//+------------------------------------------------------------------+
int getOrderShift(int magic){
   int index = 0;
   while(OrdersTotal() != 0 && OrderSelect(index, SELECT_BY_POS)){
      if(OrderMagicNumber() == magic)return(iBarShift(NULL, 0, OrderOpenTime()));
      index++;
   }
   return(-1);
}
//+------------------------------------------------------------------+ 
 

You can also do this:

//naturally loop and select first.

if(NormalizeDouble((TimeCurrent()-OrderOpenTime())/60/Period(),0)>n)then...//where n is the number of bars

 
Roger:

You can also do this:

//naturally loop and select first.

if(NormalizeDouble((TimeCurrent()-OrderOpenTime())/60/Period(),0)>n)then...//where n is the number of bars


Thanks, but I'm afraid to experiment with the datetime type - I have no conversion to other types (I prefer datetime --> int), I also have no real output