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

 
Kimeska:
Help!
On account $ 12.93 I want to open an order with 0.01 volume, stop loss and take profit 0, but the program says not enough money-what's wrong and where do I need to fix?
Change your leverage and re-enter the terminal (you may not close it), check the minimum allowable lot
 

Well this time the task is not for my mind... Hi all!!!!!!

The indicator builds levels in the form of graphical objects, which it takes from files. After that is written to arrays, for each line a different array and as a result we get the history of the line for a given number of days.

Due to changes in the compiler the previous code doesn't work anymore. A simple buffer array write line doesn't seem to work. Perhaps this is a peculiarity of the init function? Anyway, why does this line not work.

I marked it in the code.

Files:
 
Don't bother, I've already done it, and it's easy.... :-)
 

strategy - a bar appeared, setting a pending order with stoploss and takeprofit (sl, tp), and nothing else.

Let's assume that in the current bar, after some time, a price will appear for the order to trigger, later the sl price will come, and then the tp price .

Again, please explain - let's assume that the opening price of the new bar will be somewhere between the sl and tp price limits. How is this calculation performed?

Logically, it cannot, because the tester has only the next bar open price? And it is not equal to the price specified in the condition for pending order triggering, which means the order should not be triggered.

But: during the tester's run, trades are somehow executed and stops are triggered. In what way?

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

and once again the old question - "the tester creates an fxt with every start. and this is time. i couldn't find any setting hinting at avoiding this... in idea: once it should be created and if i don't change anything, i should use this file, but no, the terminal rewrites it"

 
artmedia70:
Arabic? The Cyrillic alphabet has already been written to you

 

Good evening all.

I am writing an EA (I am learning), can you tell me what blocks should be in an EA based on crossing price and moving average with a trailing stop. The more I learn, the more messy my head gets.

I am getting more and more confused. Thank you.

 
For a start:https://book.mql4.com/ru Patience and diligence!
 

Can you please tell me if there is a simple solution to this question.

My Expert Advisor calculates the lot based on the account parameters:

double lot=(AccountBalance()+AccountEquity())/K/KursS;
lot=NormalizeDouble(lot,2);
if(lot<0.01)      lot =0.01;

That is, it rounds to the second decimal place.

However, some brokers allow rounding only to the first digit, i.e. 0.1 lot may be rounded and 0.12 lot cannot be rounded.

Then it turns out like this:

double lot=InstaLot*(AccountBalance()+AccountEquity())/K/KursS;
lot=NormalizeDouble(lot,1);
if(lot<0.1)      lot =0.1;

Is it possible to teach the Expert Advisor to recognize the minimum lot and the step by itself, without manually prescribing the value in the third line of the code?

 
Answer me this question. What is the difference between compiling and arrival of a new bar???? When compiling, variable a = 22, and when the new bar arrives, a = 21. And no operations are performed on the variable. Only at change of day. And in the middle of the day here is such a crap. I compile, I receive value 22, new bar comes, value changes to 21. What the fuck.....???? and with the arrival of subsequent bars the value of the variable does not change. But here is a bitch at compilation gives out value greater by 1.
 
neman:

Can you please tell me if there is a simple solution to this question.

My Expert Advisor calculates the lot based on the account parameters:

That is, it rounds to the second decimal place.

However, some brokers allow rounding only to the first digit, i.e. 0.1 lot may be rounded and 0.12 lot cannot be rounded.

Then it turns out like this:

Is it possible to teach the Expert Advisor to recognize the minimum lot and the step by itself without having to manually prescribe the value in the third line of the code?


lots = lotstep*MathRound((AccountFreeMargin()*risk*0.01/margin)/lotstep);
if(lots < 0.01) lots = 0.01;

Where risk - percentage of free funds involved

margin = MarketInfo(Symbol(),MODE_MARGINREQUIRED) - margin for one order

lotstep = MarketInfo(Symbol(),MODE_LOTSTEP) - lot size.