[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 180

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
Good day to you all!
I'm a newbie. This is my first time trying to put an idea into code in the tester.
The idea is simple - to open one order at opening price of each hourly candlestick, alternately up and down.
I have written a simple code .... But the problem is that the program sometimes opens more than 1 order at the opening of one candlestick.
It seems to me it happens when more than 1 tick comes within 1 second.
As an alternative, I tried to put in the if( ) condition header...
Only one order really opens.
But this variant does not suit me because the next day the given candlestick is not opened, since at the moment of opening of this candlestick
there is already a random number of orders in the trade.
I also tried to interrupt OrderSend(Symbol(),OP_BUY,0.1,Price,3,SL,TP); interrupt start() execution with return; ..... did not help.
I would appreciate if you tell me how to make only 1 order is opened at any tick within 1 second.
int start()
{
double Price=Ask;
double SL=Price-300*Point;
double TP=Price+300*Point;
if( Hour()==10 && Minute()== 00 && Seconds()==00)
OrderSend(Symbol(),OP_BUY,0.1,Price,3,SL,TP);
}
Thank you very much for your prompt reply.
Try this option:
Ev. pros! Where can I find the СloseBy() function, which works in manual mode? I want to add it to my Owls, so it would not be possible to close position with maximal minus to the opposite with maximal plus, but automatically, according to the conditions. I could not find it in codebase. I have not found it in codebase. Thank you!
Try this option:
Sergei, at a cursory glance it's worthwhile! I'll screw it on, make the conditions and try it out. Thank you very much!
Tried it, it works without errors! Now only to experiment with the conditions, to get the effect, and will be fine! But that's for tomorrow!
Thank you very much. And interesting dreams!
Sergei, at a cursory glance it's worthwhile! I'll screw it on, make the conditions and try it out. Thank you very much!
Only instead of a counter-close command, insert a full-fledged counter-close function - otherwise it's only for the tester. And initialise the variables in the function.
Thank you, Artyom! It was too late. Will do everything by the rules for online today!
Good afternoon. I have such a question.
I have redesigned this indicator for my own needs with great difficulty from pieces of code of other Expert Advisors and Inductors. It is not a big code and it works the way I want it to.
The matter is that it performs some calculations internally and shows up or down arrows on the chart.
Please advise how to make an Expert Advisor to open an order in the right direction when arrow appears on the chart
More precisely, I just need to know which arrow is active now, I think I can do the rest
Here is a piece of code to make it clearer, it's an initialization in the indicator
SetIndexBuffer(1, Vverh);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,233);
SetIndexBuffer(2,Vniz);
SetIndexStyle(2,DRAW_ARROW);
SetIndexArrow(2,234);
Thanks in advance