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

 
Vinin:
The indicators just seem to be eating up resources. There are more calculations. Although - they are not really needed, but they are required.
I closed all but one of the chart windows. Removed all of the indicators. I have restarted the empty terminal (without indicators and Expert Advisors) and with one chart. - Does not work! Processor load is the same - 29%.
 
logut:
I need double lots = 0.01;
input int takeprofit = 100;
input int stoploss = 100;
extern int magic = 123;
//----------------+
int start()
{




//---------------+


int ticket=OrderSend(Symbol(),OP_BUYLIMIT,lots,Ask,3,Ask +stoploss* Point, Ask + takeprofit* Point,NULL,123,120,CLR_NONE);






return(0);

}

I need a tip on how to write an EA with a pending order. I am new to this business and have been puzzling over it for a month.
The Expert Advisor implements a strategy. The strategy implies conditions for entering and exiting the market. Therefore, we should not ask: how to write an EA for pending orders? We can ask: how to write a procedure for opening pending orders? And further, pending orders - what are they? Well, here we have an answer: pending orders are set at a certain distance from the current price. Therefore,we cannot set the current price (Ask/Bid) in variables of theOrderSend() command/functionfor pending orders. You have to set the price at a certain distance from the current price taking into consideration the requirements/limitations of your dealing centre.
 
ikatsko:
The advisor implements some kind of strategy. The strategy implies conditions for entering and exiting the market. Therefore, we should not ask: How to write an EA for pending orders? We can ask: how to write a procedure for opening pending orders? And further, pending orders - what are they? Well, here we have an answer: pending orders are set at a certain distance from the current price. Therefore,we cannot set the current price (Ask/Bid) in variables of theOrderSend() command/functionfor pending orders. You have to set the price at a certain distance from the current price taking into consideration the requirements/limitations of your dealing centre.
I tried to set PRICE_OPEN, but how to indicate at what distance
 
logut:
I tried putting PRICE_OPEN but how to specify how much distance
This is the main issue of the strategy, your strategy that you want to implement as an EA. For example, there is the current price of an instrument (e.g. EURUSD). According to your strategy, if the price goes up by 20 pips, then (!) it will definitely start to go down. Therefore you place a pending order at a distance of 20 pips from the current price.
 
ikatsko:
This is the main issue of strategy, your strategy that you want to implement in the form of an EA. For example, there is the current price of an instrument (e.g. EURUSD). According to your strategy, for example, it is assumed that if the price goes up by 20 pips, then (!) it will definitely start to go down. Therefore you place a pending order at a distance of 20 pips from the current price.

Well done. Five points.

 
ikatsko:
This is the main question of strategy, your strategy that you want to implement in the form of an EA. For example, there is the current price of an instrument (e.g. EURUSD). According to your strategy, for example, it is assumed that if the price goes up by 20 points, then (!) the price will definitely start to decrease. Therefore you place a pending order at a distance of 20 pips from the current price.

Expect a barrage of questions. What is a point, who is the Ask price, Bid price, who is the dealing centre, what is the strategy ... in short, it's a mess... You may ask questions, but the question is: What is the point of the strategy?

 
logut:
I need double lots = 0.01;
input int takeprofit = 100;
input int stoploss = 100;
extern int magic = 123;
//----------------+
int start()
{




//---------------+


int ticket=OrderSend(Symbol(),OP_BUYLIMIT,lots,Ask,3,Ask +stoploss* Point, Ask + takeprofit* Point,NULL,123,120,CLR_NONE);






return(0);

}

i need some tips on how to write a tip with a trailing stop i'm new to this business, i've been puzzling over it for a month, i have an outline
Steering wheel, boot, how to be Moscow?
 
logut:
I tried to put PRICE_OPEN but how do I specify the distance

Can I help you? I'm good at this! Insert your code with the SRC button and look how beautiful it is!

input double lots = 0.01;
input int takeprofit = 100;
input int stoploss = 100;
 extern int magic = 123;
//----------------+
int start()
{


 


//---------------+


int ticket=OrderSend(Symbol(),OP_BUYLIMIT,lots,Ask,3,Ask +stoploss* Point, Ask + takeprofit* Point,NULL,123,120,CLR_NONE);






return(0);

} 

All you have to do is to use the knowledge from the Tutorial and the Documentation to fill in all the missing pieces! Everyone has always started out the same way, and you are no exception. I wish you success in your studies!

 
AlexeyVik:

And before you repeat someone else's nonsense can't you check?

It does not matter what time StringToTime() function counts seconds from 01.01.1970 00:00:00 GMT, UTC, server time or local time, as long as the time passed from the specified date to the specified time is XXX seconds. And when you set the check time, it is also calculated from 01.01.1970 00:00:00 according to the specified by you time. In other words, in the condition if(TimeCurrent() >= StringToTime("23:15"), it means that if the server time from 01.01.1970 00:00:00 passed as much or more seconds than the specified check time ofXXX seconds. And there is no confusion about it.

Especially for you I made a screenshot, read the comment and then experiment.

Your problem may be that the trade may end at 23:00

Didn't notice the answer right away. Well to be honest I didn't quite get what you mean by claiming there's no confusion about it.

What do you mean by "it doesn't matter what timeStringToTime() counts the elapsed seconds"?

The function essentially takes a lefty date altogether (I believe the local PC date is lefty) and compares the current time of the broker's server to it, why would it not matter?

From the above screenshot, the comment says that the time on your local PC is 1 hour ahead of the broker's time, i.e. the GMT shift is greater. If it was X hours less, it would be critical, as in the case I wrote about Friday.

As for the end of trading time. I guess forStringToTime() function it shouldn't matter when broker ends trading day or week...

 
tuner:

I didn't notice the answer right away. Well to be honest I didn't quite understand what you mean by saying there's no confusion about it.

What do you mean by "no matter what timeStringToTime() counts the elapsed seconds"?

The function essentially takes a lefty date altogether (I believe the local PC date is lefty) and compares the current time of the broker's server to it, why would it not matter?

From the above screenshot, the comment says that the time on your local PC is 1 hour ahead of the broker's time, i.e. the GMT shift is greater. If it was X hours less, it would be critical, as in the case I wrote about Friday.

As for the end of trading time. I guess forStringToTime() function it shouldn't matter when broker ends trading day or week...

I have no other explanation.

If it is 11:40 in Moscow, then XXX seconds have passed from 01.01.1970 to the current time.

When it is 11:40 in London, for example, the number of seconds will be the same as in Moscow now... This is only because 01.01.1970 in London was as much later than current time. It is not the entered time, but only the number of seconds.

Try to write yourself a formula to calculate the number of seconds since 01.01.1970 00:00:00.

For a short period of time you could use this formula. From the beginning of current month passed 6*24*60*60 + 11*60*60 + 59*60 + current value of seconds on the clock you are looking at.

Reason: