[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 53

 

I noticed such a nuance when I prescribe a print in my EA, namely:

double Up = iCustom(NULL, 0, "best div original", "*** CCI-OnArray Settings ***", 12, 3, 5, 25, "*** Indicator Settings ***", false, false, false, 0, 1);

Print ("+++++++++++++", Up);

the Expert Advisor shows the following result - ++++++++++++++ 2147483647. I can see the same number for up and down buffers as well. Please, advise what kind of code this is? And how to "get" the value from Ikastom exactly when the arrow appears?

 

I ask for a little help from knowledgeable people: please advise the correct code to create an Expert Advisor/Utility whose algorithm is as follows:

- opening a double deal in ONE direction (lots 0.1 and 0.1) is made at the moment of crossing low (sell)/high (buy) of the last formed candle in the current chart / current time frame with a stop near the high / low of the candle, at the crossing of which opened a given transaction and placing in the same point pending order double deal in one direction with lots, such as 0.2 and 0.1.

 

Question:

There is code

int start()

if (H==TimeHour(TimeCurrent()) && M==TimeMinute(TimeCurrent()) && S==TimeSeconds(TimeCurrent())

{+ some conditions

Then the order is opened

Ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,2,SL,TP);
if (Ticket > 0)
Alert ("Buy order opened ",Ticket);

return;}

But if at this moment there is no tick it is not triggered

But if I give it more time to think it may open several orders.

I should have only one order without paying attention to already open orders.

Please advise what to do

 
v2812:

I have noticed such a nuance when I prescribe a print in my EA, namely:

double Up = iCustom(NULL, 0, "best div original", "*** CCI-OnArray Settings ***", 12, 3, 5, 25, "*** Indicator Settings ***", false, false, false, 0, 1);

Print ("+++++++++++++", Up);

the Expert Advisor shows the following result - ++++++++++++++ 2147483647. I can see the same number for up and down buffers. Please, advise what kind of code this is? And how to "get" the value from Ikastom exactly when the arrow appears?


Try to pass the indicator values not through iCustom() but through the global variables of the terminal. These are the ones you can see by F3. The matter is that it is not an uncommon situation when it is the only normal way of data transmission. I've had such cases.

It is quite possible that in your indicator some types of arrows are drawn through the indicator buffer, while others are created as objects. This is the only reason why there may be no arrow prices in the data window - the data is output to this window from the indicator buffers.

 
palesandr:

Question:

There is code

int start()

if (H==TimeHour(TimeCurrent()) && M==TimeMinute(TimeCurrent()) && S==TimeSeconds(TimeCurrent())

{+ some conditions

Then the order is opened

Ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,2,SL,TP);
if (Ticket > 0)
Alert ("Buy order opened ",Ticket);

return;}

But if at this moment there is no tick it is not triggered

But if I give it more time to think it may open several orders.

I should have only one order without paying attention to already open orders.

Please advise what to do


The EA code is triggered ONLY when a new tick arrives. More than one order is opened because on the next tick the setup signal is also true and there is no check on the number of orders. We need to recalculate the orders.
 
drknn:


Try to pass indicator values not through iCustom(), but through variables of global terminal level. These are the ones that can be viewed by F3. The matter is that it is not an uncommon situation when it is the only normal way of data transmission. I've had such situations.

It is possible that in your indicator some arrow types are drawn through an indicator buffer and others are created as objects. This is the only reason why there may be no arrow set prices in the data window - the data is output to this window from indicator buffers.


Thank you very much! I will now try to prescribe as you said.
 
palesandr:
But if there is no tick at this point, it is not triggered

and if you give it more time to think, it may open several orders.

But I only need one and I don't want it to pay attention to orders that are already open.

Can you tell me what to do
?


1. Global datetime last_dt;


2. Make correct time

datetime dt=StrToTime(H+": "+M+": "+S);


3.

if (TimeCurrent()>=dt && last_dt<dt) // the right time has arrived and it is the next day

{

// open the order

if (ticket>0) last_dt=TimeCurrent(); // remember the time of opening

}

 
v2812:

then the EA gives the following result - ++++++++++++++ 2147483647. And the same number for both the up and down buffers.

2147483647 - this is the EMPTY_VALUE constant
 

I understand that.

I need to be more specific about order recalculation. Maybe an example (in code form) or a link .

I have tried it like this

if (Ticket > 0)
Alert ("Opened Buy order ",Ticket);

sleep (10000)
return;}

failed for some reason

drknn:

The EA code is triggered ONLY when a new tick comes in. The order opens more than one because on the next tick the set signal is also true and there is no check for the number of orders. We need to recalculate the orders.
 

I want the software to ignore the date, only the time is important

Will your advice work in this case?

sergeev:


1. Global datetime last_dt;


2. make it correct time

datetime dt=StrToTime(H+": "+M+": "+S);


3.

if (TimeCurrent()>=dt && last_dt<dt) // it is the right time and it is the next day

{

//open order

if (ticket>0) last_dt=TimeCurrent(); // remember opening time

}

Reason: