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

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
The general idea, of course, is this. And how do you determine the width of the channel (range in your case)? I do it through the size of an average candle plus it's all tied to the length of the channel, because the presence of the channel is not checked on a rigid number of bars, but, for example, on a length of 10 to 30 bars.
What I am interested in is the question of selecting the width from the length...
You can make several external parameters for the channel width in one indicator. And make separate calculations for each parameter.
For length, the same is true.
Hello. The basket Expert Advisor should close all the orders when the condition comes, but it closes the order first, then tries to close it again (the server gives us an error saying "Invalid ticket") and only then it goes further. Here is a sample code and the EA itself.
In your function CloseOrders(), if the order is closed, the while(cnt<=5 ) cycle will once again send the code to close the order, and an error will occur, of course, then exit through if(). break;
In the ProtectionClose() function, you have already added lines with the correct while exit.
Try to dig here.In your function CloseOrders(), if the order is closed, the while(cnt<=5) cycle will once again send the code to close the order, and an error will occur, of course, then exit through if(). break;
In the ProtectionClose() function, you have already added lines with the correctwhile exit
Try to do some digging here.But in the case I have described, it is the ProtectionClose() function that closes the order. I will correct that error.
However, it is the ProtectionClose() function that closes orders in the case I have described. I will fix that error.
I haven't dug deep into code, I couldn't run it in tester, there is no indicator.
But, for example, your functions OpenUsdbuy(); OpenSellusd() are consecutive.
OpenSellusd() opens GBPUSD, EURUSD, AUDUSD, NZDUSD, etc. You will be the first to close them in reverse order of NZDUSD, AUDUSD, etc.
Only three pairs in the ProtectionClose() function have a while exit in two variants: USDCAD, USDCHF and USDJPY.
In other currencies, you can exit while() only by an error if(!Result[...]).
It is possible to make several external parameters for the channel width in one indicator. And make separate calculations for each parameter.
The point is that I do not want to set the channel width forcibly - the Expert Advisor/indicator must detect the presence of the channel regardless of the currency pair and/or the current volatility. Accordingly, I set the minimum and the maximum channel length from external parameters, and this only in the process of debugging the algorithm - afterwards these parameters will be sewn into it. At this stage, there are some complaints. Although I can catch the channels in general (the picture was taken from the working code), I would like to see other solutions of this issue.
I haven't dug deep into code, I couldn't run it in tester, there is no indicator.
But, for example, your functions OpenUsdbuy(); OpenSellusd() are consecutive.
OpenSellusd() opens GBPUSD, EURUSD, AUDUSD, NZDUSD, etc. You will be the first to close them in reverse order of NZDUSD, AUDUSD, etc.
Only three pairs in the ProtectionClose() function have a while exit in two variants: USDCAD, USDCHF and USDJPY.
In other currencies you can exit while() only by an error if(!Result[...])
Thanks for the tip, I forgot to leave the loop in this case, it should work now. If you want I can paste the indicator as a thank you.
The general idea, of course, is this. And how do you determine the width of the channel (range in your case)? I do it through the size of an average candle plus it's all tied to the length of the channel, because the presence of the channel is not checked on a rigid number of bars, but, for example, on a length of 10 to 30 bars.
It is the choice of width from length that interests me...
Well, in my case, I suggested a lighter option from the lantern to assign the channel height and the minimum number of bars as well.
The point is that I do not want to set the channel width forcibly - the Expert Advisor/indicator must detect the presence of the channel regardless of the currency pair and/or current volatility. Accordingly, I set the minimum and the maximum channel length from external parameters, and this only in the process of debugging the algorithm - afterwards these parameters will be sewn into it. At this stage, there are some complaints. Although I can catch the channels in general (the picture was taken from the working code), I would like to see other solutions of this issue.
The point is that I do not want to set the channel width forcibly - the Expert Advisor/indicator has to determine the presence of the channel, regardless of the currency pair and/or the current volatility. Accordingly, I set only the minimum and maximum length of the channel from external parameters, and this only in the process of debugging the algorithm - afterwards these parameters will be sewn into it. At this stage, there are some complaints. Although I can catch the channels in general (the picture was from the working code), I would like to see other solutions for this issue.
Well, there is an idea to catch 2 consecutive top fractals or 2 iHighest ones consisting of, say, 5-10 candlesticks. We catch this case within a certain length range. If values of these peaks are close to each other, between these two peaks we will find iLowest.
Similarly, first search for two lower peaks, and then for the upper peak between them.
Then we will dance from those found peaks. First, we draw levels by them. Then we teach the code to think further.
This option will eliminate the external parameter such as Channel_width.
Whatever way you look at it, I think we need at least some parameters for the length.
As far as my robot is concerned, I've got a bit of a handle on the code. I only kept a rough version of it, which is strictly aimed at certain parameters for ХХХ\JPY currency pairs. I remember doing some online testing while working in a channel. I'll send you the code right now, but I don't think it will be of much help.