[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 396
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
I'm trying to write a very basic MA advisor, but it should close at stop or profit instead of backwards crossover. This is what I messed up. As a result, I got the error '\end_of_program' - no function defined. Please help me, what's wrong? And if you can give me some clarifications.
extern double Lots = 0.1;
extern double MovingPeriod = 8;extern double MovingShift = 0;
extern double TakeProfit = 400.0;
extern double Stoploss = 100.0;
OrdersTotal(0);
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
if(Volume[0]>1)
iMA=iMA(NULL,0,8,0,MODE_SMA,PRICE_CLOSE,0);
if(Open[1]>iMA && Close[1]<iMA)
OrderSend(Symbol(),OP_SELL,0.01,Bid,3,Ask-150*Point,Ask+400*Point,"",0,0,Red);
return;
if(Open[1]<iMA && Close[1]>iMA)
OrderSend(Symbol(),OP_BUY,0.01,Ask,3,Bid-150*Point,Bid+400*Point,"",0,0,Blue);
return;
I'm trying to write a very basic MA advisor, but it should close at stop or profit instead of backwards crossover. This is what I messed up. As a result, I got the error '\end_of_program' - no function defined. Please, help me, what's wrong? And if you can give me some clarifications.
/*code*/Good afternoon!
First, the code should not be "hanging in the air" but in some function.
Second, there must be a start() function that will be called every tick and must contain the basic logic
Thirdly, the code is inserted using the SRC button (the button bar is just above the window where you type the message text)
If the Metatrader folder is copied/cut from one PC to another, will the terminal be fully operational in the new location, just as in the original location?
Good afternoon. Question about OBJPROP_TIMEFRAMES property identifier of graphical objects... I wrote this script to create a Horizontal Line graphical object (see below).
Question: Why, although the ObjectSet(object_name,OBJPROP_TIMEFRAMES,PERIOD_H1) function explicitly states that the object should display ONLY on timeframe H1, the created object also displays on timeframes (at least) H4, M30, M15.
Note: the header of the script contains a line with the include file #include <WinUser32.mqh> which differs from the source include file #include <WinUser32.mqh> delivered with the client terminal.
Good afternoon. Question about OBJPROP_TIMEFRAMES property identifier of graphical objects... I wrote this script to create a Horizontal Line graphical object (see below).
Question: Why, although the ObjectSet(object_name,OBJPROP_TIMEFRAMES,PERIOD_H1) function explicitly states that the object should display ONLY on timeframe H1, the created object also displays on timeframes (at least) H4, M30, M15.
https://docs.mql4.com/ru/constants/objects/visible
Another constant is OBJ_PERIOD_H1
Good day! Here is a question:
I need to calculate the total number of buy-tails of previous bars using the formula close[1]-low[1] in pips
it would look like this
...
int xBost_b;
if(close[1]>open[1])
xBost_b=xBost_b+((close[1]-low[1])*10000);
...
but all that is written in start() at every tick
i.e. with every tick one and the same bar is incremented several times, but how should i make the previous bar (for example if i buy) be calculated/plugged 1 time?
Good day! Here is a question:
I need to calculate the total number of buy-tails of previous bars using the formula close[1]-low[1] in pips
it would look like this
...
if(close[1]>open[1])
xBost_b=xBost_b+((close[1]-low[1])*10000);
...
but everything that is written in the start() is executed at every tick
i.e. with every tick one and the same bar is added several times, how to make previous bar (for example if I buy) is calculated/added to variable 1 time?
a) write a script, it will count only 1 time
b) count the necessary number of bars each time
c) to find out when a new bar starts and only then "add" the previous bar to the calculation
d) if it is an indicator, use IndicatorCounted()
Choose the one that is better for your task
a) write a script, it will count only 1 time
b) count the right number of bars each time
c) find out when a new bar starts and only then "add" the previous bar to the calculation
d) if it is an indicator, use IndicatorCounted()
choose what is better for your task
I need it as an Expert Advisor; I can't decide if I should get it right or not.
Start - how to count each bar type once in start()...
i.e. while the current bar[0] is being built, the previous one is being defined
and if we buy, we find the tail in pips and add to the variable 1 time
i need your help!