[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 329

 
Zhunko:

Unfortunately, all variants without DDE are doomed to lose ticks from packs. They can be recovered by approximation, but this is not very good.

There is an option to retrieve via DDE directly from Exel.


Vadim, thank you. I'll have a look.
 
granit77:
1. https://www.mql5.com/ru/articles/1368
2. https://www.mql5.com/ru/forum/100028/page58#94290

And in the first approximation, that's enough.

Victor, thank you from the bottom of my heart. I will definitely look into this article and Rosh's recommendations.
 

Hello all! Attempt #3 :))

Dear Professionals!!!

Look, please, I don't understand what the problem is. When trying to place one pending order, two are placed.

while (Ticket2<0)

{

RefreshRates();

Ticket2=OrderSend(Symbol(),2,Lots_New*2,price,2,0,TP,"",MN); //1 order is pending Buy

Alert ("Error in Cycle",GetLastError()); Alert ("TIK2= ",Ticket2;)

Sleep(500);

}

Thanks in advance to everyone who responds.

 
demlin:

Hello all! Attempt #3 :))

Dear Professionals!!!

Look, please, I don't understand what the problem is. When trying to place one pending order, two are placed.

while (Ticket2<0)

{

RefreshRates();

Ticket2=OrderSend(Symbol(),2,Lots_New*2,price,2,0,TP,"",MN); //1 order is pending Buy

Alert ("Error in Cycle ",GetLastError()); Alert ("TIK2= ",Ticket2;)

Sleep(500);

}

Thanks in advance to everyone who responds.


Add flags ( pending order presence) in condition to ticket number, i.e. first flag - false, then in condition - while ticket < 0 and flag==false - set pending and put flag in true. After the pending order triggers on the market or deletes the pending order - reset the flag to false. Try it this way...
 

There is this question: how to display the price at the edges of the Trendline. Or to have the right (left) price marker magnetised to the Trendline or to the Low (High) bar as the Trendline itself does. I would like to use the standard MT4 charting tools. But if this is not possible, maybe I need an indicator that attaches the right (left) price tags to all the Trendlines in the window (I use 4 Trendlines and all need prices at the edges)? The Trendline is without a beam and the edges are attached to High or Low bars - naturally manually. A chain of four Trendlines is similar to the ZigZag indicator. I have no experience in writing indicators. I am actually writing because of it. I have no experience in writing indicators.

 
demlin:

Hello all! Attempt #3 :))

Dear Professionals!!!

Look, please, I don't understand what the problem is. When trying to place one pending order, two are placed.

while (Ticket2<0)

{

RefreshRates();

Ticket2=OrderSend(Symbol(),2,Lots_New*2,price,2,0,TP,"",MN); //1 order is pending Buy

Alert ("Error in Cycle ",GetLastError()); Alert ("TIK2= ",Ticket2;)

Sleep(500);

}

Thank you in advance if you reply to this question.

The logic is very simple:

If there is no pending order with the right type, then set it. THAT IS ALL...

 

I have a question, there is a certain indicator which gives a signal when a certain condition is reached,

My question is how to make it open an order instead of a signal,

Here is the code for the signal and the message

if (SoundON==true && i==1 && CrossUp[i] > CrossDown[i] && alertTag!=Time[0]){
         Alert("Открываем Селл ",Symbol()," ",Period());
        alertTag = Time[0];

I tried to put just a place for the alert to open it does not work,

If I have an EA with description of what to attach from the indicator I will be very grateful.

 
FoxUA:

I have a question, there is a certain indicator which gives a signal when a certain condition is reached,

My question is how to make it open an order instead of a signal,

Here is the code for the signal and the message

if (SoundON==true && i==1 && CrossUp[i] > CrossDown[i] && alertTag!=Time[0]){
         Alert("Открываем Селл ",Symbol()," ",Period());
        alertTag = Time[0];

I tried to put just a place for the alert to open it does not work,

I would be very thankful if I had a code with description of what to attach from the indicator.

The indicator cannot open orders. This is the EA's job. If this code belongs to the indicator, we have to write the data into its buffer created especially for this data. When there is no signal, a zero or an empty value is written to the buffer and when there is a signal (as in your example), instead of Alert(); write the value in the buffer.
For example:
+1 for Buy and
-1 for Sell.
Then read data from the buffer in the Expert Advisor using iCustom();.

Or write all these conditions directly in the Expert Advisor.

 

Good morning!

Can you please advise me, I open order every day

Magic_b++; OrderSend (Symbol(), OP_BUY, Loot,Ask, 50, SL, TP,NULL,Magic_b,0,L) (or Magic_s++; OrderSend (Symbol(), OP_BUY, Loot,Bid, 50, SL, TP,NULL,Magic_s,0,L; depending on conditions);

I want to close an open order every day at a certain time. I use the following scheme for that (except Fridays)

if ((DayOfWeek () == 1) || (DayOfWeek () == 2) || (DayOfWeek () == 3) || (DayOfWeek () == 4 ))

{if (((timecur > "23:59:00") && (timecur < "23:59:04")) && (iOpen(Symbol (), PERIOD_H4, 0)

!= iOpen(Symbol (), PERIOD_D1, 0))

{if (iOpen(Symbol (), PERIOD_H4, 0) > iOpen(Symbol (), PERIOD_D1, 0))

{ Alert ("price is higher");

for(i=OrdersTotal()-1;i>=0;i--)

{ OrderSelect(i, SELECT_BY_POS

if(OrderMagicNumber()==Magic_b)

{Alert ("orderticket",OrderTicket();

OrderClose(OrderTicket(),Loot,Bid,80,R);

Alert ("GetLastError");

Control = 0;

Magic_b++;

} } }

if (((timecur > "22:59:00") && (timecur < "22:59:04")) && (iOpen(Symbol (), PERIOD_H4, 0)

!= iOpen(Symbol (), PERIOD_D1, 0))

{if (iOpen(Symbol (), PERIOD_H4, 0) < iOpen(Symbol (), PERIOD_D1, 0))

{ Alert (" price is higher");

for(i=OrdersTotal()-1;i>=0;i--)

{ OrderSelect(i, SELECT_BY_POS

if(OrderMagicNumber()==Magic_s)

{Alert ("orderticket",OrderTicket();

OrderClose(OrderTicket(),Loot,Ask,80,R);

Alert(GetLastError);

Control = 0;

Magic_s++;

} } } } }

But in the tester for some reason is not closed every day (for example in testing from 23.08-23.10 2010) closed only 27.09. And 24.08, despite the fact that not implemented nytp,no SL- trade is not closed. already third day headache, I can not figure out what is wrong. please help

P.S. condition of entering always coincides with a condition of closing (except for time of course, it is possible to admit that here time of October 22:01:00)

 
Maybe because the range is too small, only 4 seconds? There are few ticks in the bar at this time and the tester may not hit the set interval.
Reason: