Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1098
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
iHighest, iLowest will give the candle address, not the price.
That's right. We need
double Vhod1=iHigh(Symbol(), 0, iHighest(Symbol(),0,MODE_HIGH,8,0));
double Vhod2=iLow(Symbol(), 0, iLowest(Symbol(),0,MODE_LOW,8,0));
I put it in wrong, but it still wouldn't have worked properly because... Because.) Anyway, it should go like this:
1) create an AllowNewOrders variable in the inite (if it doesn't exist)
2) Create a new order, until it closes, OnTick of this symbol is idle, but will run OnTick of another symbol
3) Perform step 2 for the other symbols until the MaxOpenOrders limit is reached
4) when the order finishes, if it is losing or has zero value, prohibit opening new orders for all copies through AllowNewOrders
[here is the immediate problem - when the losing series finishes, AllowNewOrders=1, but what if MaxOpenOrders>1 and there are several of these sessions?]
5) If point 4 is not fulfilled, then you may open new orders.
The program MUST work when MaxOpenOrders=1. Perhaps, there will be a problem if we forbid new orders following an unprofitable order AllowNewOrders=0 and the next OrderSend, for some reason, does not open the order. I will write below how I hedge for this case...
I will write below how I hedge for this eventuality...
If the error solution is properly foreseen, the success rate of opening an order increases.
How can the code below change under such conditions?
for(cnt=OrdersTotal()-1;cnt>=0;cnt--){
if (!OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)) continue;
if(OrderSymbol()!=Symbol()) continue; if(OrderMagicNumber() < startMagicNumber || OrderMagicNumber() >= startMagicNumber + MaxTrades) continue;
I put the code to generate a magik when opening the first orders of a series, but here is the problem when opening new orders in the same series.
The code itself to generate the magic from the post://+------------------------------------------------------------------+
// get the next magic in the series
int getNextMagicNumber(){
int magic = EMPTY;
if (OrdersTotal() == 0) {
return(startMagicNumber);
}
for (int i = startMagicNumber; i < startMagicNumber + MaxTrades; i++){
magic = checkMarketByMagic(i);
if (magic != EMPTY) break;
}
if (magic == EMPTY){
magic = startMagicNumber; // first in the series
} else {
magic++; // next in the series
}
return(magic);
}
//+------------------------------------------------------------------+
// keekkenen: check for an order in the market with a given magic
int checkMarketByMagic(int magic){
for(int i = 0; i < OrdersTotal(); i++){
if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;
if(OrderSymbol() != Symbol()) continue;
if(OrderMagicNumber() == magic) return(magic);
}
return(EMPTY);
}
//+------------------------------------------------------------------+
apologize if I confused the threads, but I have not found the correct place to post the THEME, so do not kick me.
Sometimes, while surfing the Internet for new Expert Advisors, I came across one that I didn't pay attention to, because its description was standard, of which there are many.
If I had not seen or read it, please give me the name, and google will do its job or if I have one, I will take it as a gift. Maybe there is a similar advisor performs similar actions.
I will describe the meaning of the Expert Advisor (there is nothing very sophisticated, what I need now).
Roughly speaking, the job would look like this:
1. Open a position manually, for example buy.
2. The Expert Advisor sets Stop Loss and Take Profit according to the settings.
3. The order is closed at takeprofit - the EA immediately opens another buy and sets the same stoploss and takeprofit until it catches the first stoploss or if there is an ultimate takeprofit.
4. If the position is closed by Stop Loss, the robot does nothing more. The Expert Advisor waits for the next order to be opened manually.
That is all.
I would be very grateful.
I inserted it wrong, but it still wouldn't work properly, because... Because.) Anyway, it goes like this:
1) create an AllowNewOrders variable in the initem (if it does not exist)
2) Create a new order until it closes OnTick of this symbol is idle, but OnTick of the other symbol will work
3) Perform step 2 for the other symbols until the MaxOpenOrders limit is reached
4) when the order finishes, if it is losing or has zero value, prohibit opening new orders for all copies through AllowNewOrders
[here is the immediate problem - when the losing series finishes, AllowNewOrders=1, but what if MaxOpenOrders>1 and there are several of these sessions?]
5) If point 4 is not fulfilled, then you may open new orders.
The program MUST work when MaxOpenOrders=1. Perhaps, there will be a problem if we forbid new orders following an unprofitable order AllowNewOrders=0 and the next OrderSend, for some reason, does not open the order. I will write below how I am hedging for this case.
Thanks Alexander, I will check it tomorrow. [hence the problem immediately - when losing series ends, AllowNewOrders=1, but if MaxOpenOrders>1 and there is more than one session?] If MaxOpenOrders>1 by some value, then in idea AllowNewOrders=1 should also be greater by the same value. But I don't need to bother with it for now and MaxOpenOrders should be omitted altogether, because in this version of the program no more than one series is planned anyway.
Hi all !
Here is a graphical object on a graph.
Its parameters are time, value , code. The value corresponds to the price at which the object is located.
Is there any way to get its time and value (through a function or something else) ?
\\\\\
Or, in a broader sense, are there any objects (apart from trend lines, Fibonacci lines, Gannets) that enable us to get their time and price instantly?
I need to place some markers on the chart and obtain information from them. Drawing trend lines , fibo, etc... - It's awfully cumbersome and slow...
Thanks for the answers !
PS Just started studying...
Hi all !
Here is a graphical object on a graph.
Its parameters are time, value , code. The value corresponds to the price at which the object is located.
Is there any way to get its time and value (through a function or something else) ?
\\\\\
Or, in a broader context, are there any objects (apart from trend lines, Fibonacci lines, Gannets) that can be immediately derived at time and price?
I need to place some markers on the chart and obtain information from them. Drawing trend lines , fibo, etc... - It's awfully cumbersome and slow...
Thanks for the answers !
PS Just started studying...
https://docs.mql4.com/ru/objects/objectgetinteger
I tried it, the first five minutes worked fine, then I started opening several trades simultaneously (4) and on the same pair with an increased lot. Alexander, I'm not quite clear in your version, how does the global variable get and change its value?