Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 55

 
trader781:
I don't use classes, arrays, macros and importing from Windows libraries yet. All in good time.
You shouldn't have done it with arrays. Arrays are handy. And so are structures. The rest, yes, you may never use at all if the projects are not very complex.
 
Vitalie Postolache:
With arrays it's a waste. Arrays are handy. And so are structures. The rest, yes, can never be used at all if the projects are not complex.
As for arrays, I agree that they are very handy and you often cannot write a sensible program without them. Structures... I like to use classes in web-programs, it's really not convenient, especially if the project is big, and I don't like using MQ in usual one-page Expert Advisor. I've written in OOP all data on open/closed, started using and deleted everything, rewrote in procedural style and using, wrote everything in one loop. So classes are a bit of an acquired taste.
 
Vitaly Muzichenko:
Arrays, I agree, are very handy, and you often can't write a program sensibly without them. Structures... I write classes in web-programs, it's really bad and not convenient without them, especially if the project is big, but I didn't like MQ in usual one-page Expert Advisor. I've written in OOP all open/closed data, started to use and deleted everything, rewrote in procedural style and use, wrote everything in one loop. So classes are for aficionados.
Hmmm. What's that got to do with classes? Structures and classes are a bit different things. I wrote about structures. MqlRates and so on and so forth...
 

Please help me add the maximum number of open orders (MAXORders)


//
extern string rem2 = "=== Number of lots ===";
extern double _Lots0_1 = 0.1; // Base level (for the 1st order)
extern double _Lots0_2 = 0.1; // Base level (for the 2nd order)
//
extern string rem3 = "=== Additional parameters ===";
extern int _TakeProfit1_Proc = 50; // Percent risk for take profit of the 1st order
extern int _SpaseFromMaxMin = 1; // Offset From Top/Bottom
//
extern string rem4 = "=== Breakeven parameters ===";
extern bool _IsStopLoss_0 = false; // Enabling the use of the breakeven level
extern int _StopLoss_0_From = 0; // Offset from the breakeven level (in points)
extern int _StopLoss_0_Level = 15; // Breakeven level
//
extern string rem5 = "=== Trailing stop parameters ===";
extern bool _IsTrailingStop = false; // Enable trailing stop
bool _IsTrailingStopProfit = true; // Enabling a trailing stop from a breakeven position
//extern int _TrailingStopProfit_From = 0; // Offset from the breakeven level (in points)
extern int _TrailingStopLevel = 15; // Trailing stop level
extern int _TrailingStopStep = 5; // Trailing stop move step
//
extern string rem6 = "=== Tool settings ===";
extern string _Symboll = ""; // Symbolic name of the instrument: "" - current symbol
extern int _Timeframe = 0; // Period: 0 - period of the current chart
int_Digitss; // Number of digits after the decimal point in the price
double _Points; // Point size in quote currency
extern int _Slippage = 2; // slippage
extern int _Magic1 = 1281; // Unique number of EA orders (1st order)
extern int _Magic2 = 1282; // Unique number of EA orders (2nd order)
//
extern string rem7 = "=== MA1 indicator parameters ===";
extern int _MA1_Timeframe = PERIOD_D1; // Period: 0 - period of the current chart
extern int _MA1_Period = 20; // Averaging period for calculating the moving average
extern int _MA1_Shift = 0; // Indicator shift relative to the price chart
extern int _MA1_Method = 0; // Averaging method: 0 - SMA, 1 - EMA, 2 - SMMA, 3 - LWMA
extern int _MA1_Applied_Price = 0; // Used price: 0 - close, 1 - open, 2 - high, 3 - low
//
extern string rem8 = "=== MA2 indicator parameters ===";
extern int _MA2_Timeframe = PERIOD_H4; // Period: 0 - period of the current chart
extern int _MA2_Period = 20; // Averaging period for calculating the moving average
extern int _MA2_Shift = 0; // Indicator shift relative to the price chart
extern int _MA2_Method = 0; // Averaging method: 0 - SMA, 1 - EMA, 2 - SMMA, 3 - LWMA
extern int _MA2_Applied_Price = 0; // Used price: 0 - close, 1 - open, 2 - high, 3 - low
//
extern string rem9 = "=== Bollinger Bands indicator parameters ===";
//extern int _BB_Timeframe = 0; // Period: 0 - period of the current chart
extern int _BB_Period = 20; // Averaging period of the main indicator line
extern int _BB_Deviation = 2; // Deviation from the main line
extern int _BB_Bands_Shift = 0; // Indicator shift relative to the price chart
extern int _BB_Applied_Price = 0; // Used price: 0 - close
//
extern string rem10 = "=== ZigZag indicator parameters ===";
//extern int _ZZ_Timeframe = 0; // Period: 0 - period of the current chart
extern int _ZZ_ExtDepth = 12;
extern int _ZZ_ExtDeviation = 5;
extern int _ZZ_ExtBackstep = 3;
//
datetime_TimePrevious;
datetime _TimeCurrent;
//
string_fstr;
int_tp;
//



void MaxOrders(int max_orders=5);










//=++============================================ =================++=
int init()
{
if(_Symbol == "") _Symboll = Symbol();
//
_Digitss = MarketInfo(_Symbol, MODE_DIGITS);
_Points = MarketInfo(_Symbol, MODE_POINT);
//
if(_Timeframe == 0) _Timeframe = Period();
Print("v128-2 > init() >> _Timeframe=", _Timeframe,
"rem4=",_IsStopLoss_0,
"rem5=",_IsTrailingStop,_IsTrailingStopProfit);
//
_fstr = "v128_";
_tp = _FileReadWriteDouble(_fstr+"_tp.dat", 0); // make sure the file exists, if it doesn't exist, create it
Print("v128-2 > init() >> _Timeframe=", _Timeframe, " _tp=",_tp);
//
_TimePrevious=iTime(_Symbol, _Timeframe, 0);
//
Print("v128-2 > Done: init() >> _TimePrevious=", _TimePrevious, " (", TimeToStr(_TimePrevious,TIME_DATE|TIME_MINUTES), ")");
return(0);
}


//=++============================================ =================++=
int start()
{
double P_Close1, P_Close2;
double BB_1_upper, BB_1_lower;
double MA1_0, MA2_0;
double P_ask, P_bid;
bool is_signal_2_buy, is_signal_2_sell;
double P1_buy, P2_buy, P3_buy;
double P1_sell, P2_sell, P3_sell;
bool is_b1 = false, is_s1 = false;
bool is_b2 = false, is_s2 = false;
int ticket;
//
_TimeCurrent = iTime(_Symbol, _Timeframe, 0);
if(_TimeCurrent != _TimePrevious)
{
MA1_0 = iMA(_Symbol, _MA1_Timeframe, _MA1_Period, _MA1_Shift, _MA1_Method, _MA1_Applied_Price, 0);
MA2_0 = iMA(_Symbol, _MA2_Timeframe, _MA2_Period, _MA2_Shift, _MA2_Method, _MA2_Applied_Price, 0);
BB_1_upper = iBands(_Symbol, _Timeframe, _BB_Period,_BB_Deviation,_BB_Bands_Shift,_BB_Applied_Price, MODE_UPPER, 1);
BB_1_lower = iBands(_Symbol, _Timeframe, _BB_Period,_BB_Deviation,_BB_Bands_Shift,_BB_Applied_Price, MODE_LOWER, 1);
P_Close1 = iClose(_Symbol, _Timeframe, 1);
P_Close2 = iClose(_Symbol, _Timeframe, 2);
P_ask = MarketInfo(_Symbol, MODE_ASK);
P_bid = MarketInfo(_Symbol, MODE_BID);
Print("v120-4 > ", _Symbol, " | ", _Timeframe,
" -> MA1_0=", MA1_0, " | MA2_0=", MA2_0,
" -> BB_1_upper=", BB_1_upper, " | BB_1_lower=", BB_1_lower,
" -> P_Close1=", P_Close1, " | P_Close2=", P_Close2,
" -> ask=", P_ask, " | bid=", P_bid);
//
is_signal_2_buy = P_bid >= MA1_0 && P_bid >= MA2_0 && P_Close1 >= BB_1_lower && P_Close2 <= BB_1_lower && P_bid >= BB_1_lower;
is_signal_2_sell = P_bid <= MA1_0 && P_bid <= MA2_0 && P_Close1 <= BB_1_upper && P_Close2 >= BB_1_upper && P_bid <= BB_1_upper;
Print("v128-2 > ", _Symbol, " | ", _Timeframe,
" -> is_signal2 -> buy=", is_signal_2_buy, " | sell=", is_signal_2_sell);
// ========== by market
// ========== opening a BUY order
if( is_signal_2_buy )
{
Print("v128-2 > ", _Symbol, " | ", _Timeframe,
" -> signal to open a BUY order");
OrdersDeleteAll(OP_SELL);
//
if(!is_b1 || !is_b2)
{
P1_buy = P_ask;
P3_buy = FindPriceMinMax(false) - (_SpaseFromMaxMin) * _Point;
_tp = (P1_buy - P3_buy) / _Point * (_TakeProfit1_Proc / 100.0);
P2_buy = DoubleTestZero(_tp, P1_buy + (_tp) * _Point);
//
_FileWriteDouble(_fstr+"_tp.dat", _tp);
//
Print("v128-2 > ", _Symbol, " | ", _Timeframe,
" -> BUY -> P1_buy=", P1_buy, " | P2_buy=", P2_buy, " | P3_buy=", P3_buy, "_tp=", _tp);
//
ticket = OrderSend(_Symbol, OP_BUY, _Lots0_1, ND(P1_buy), _Slippage, ND(P3_buy), ND(P2_buy),
NULL, _Magic1, 0, CLR_NONE);
if(ticket == -1)
Print("v128-2 > ", _Symbol, " | ", _Timeframe,
" -> BUY (1) > Error (opening) #", GetLastError());
else is_b1 = true;
//
ticket = OrderSend(_Symbol, OP_BUY, _Lots0_2, ND(P1_buy), _Slippage, ND(P3_buy), 0,
NULL, _Magic2, 0, CLR_NONE);
if(ticket == -1)
Print("v128-2 > ", _Symbol, " | ", _Timeframe,
" -> BUY (2) > Error (opening) #", GetLastError());
else is_b2 = true;
//
}
else { is_b1 = true; is_b2 = true; }
}
else { is_b1 = true; is_b2 = true; }
//Print("= buy +++",is_b1,is_b2,"==",is_s1,is_s2);
// ========== opening a SELL order
if( is_signal_2_sell )
{
Print("v128-2 > ", _Symbol, " | ", _Timeframe,
" -> signal to open a SELL order");
OrdersDeleteAll(OP_BUY);
//
if(!is_s1 || !is_s2)
{
P1_sell = P_bid;
P3_sell = FindPriceMinMax(true) + (_SpaseFromMaxMin) * _Point;
_tp = (P3_sell - P1_sell) / _Point * (_TakeProfit1_Proc / 100.0);
P2_sell = DoubleTestZero(_tp, P1_sell - (_tp) * _Point);
//
_FileWriteDouble(_fstr+"_tp.dat", _tp);
//
Print("v128-2 > ", _Symbol, " | ", _Timeframe,
" -> BUY -> P1_sell=", P1_sell, " | P2_sell=", P2_sell, " | P3_sell=", P3_sell);
//
ticket = OrderSend(_Symbol, OP_SELL, _Lots0_1, ND(P1_sell), _Slippage, ND(P3_sell), ND(P2_sell),
NULL, _Magic1, 0, CLR_NONE);
if(ticket == -1)
Print("v128-2 > ", _Symbol, " | ", _Timeframe,
" -> SELL (1) > Error (opening) #", GetLastError());
else is_s1 = true;
//
ticket = OrderSend(_Symbol, OP_SELL, _Lots0_2, ND(P1_sell), _Slippage, ND(P3_sell), 0,
NULL, _Magic2, 0, CLR_NONE);
if(ticket == -1)
Print("v128-2 > ", _Symbol, " | ", _Timeframe,
" -> SELL (2) > Error (opening) #", GetLastError());
else is_s2 = true;
//
}
else { is_s1 = true; is_s2 = true; }
}
else { is_s1 = true; is_s2 = true; }
//Print("= sell +++",is_b1,is_b2,"==",is_s1,is_s2);
// ==========
if(is_b1 && is_s1 && is_b2 && is_s2)
_TimePrevious=_TimeCurrent;
}
//
if(_IsTrailingStop)
{
if( !FindOrders(_Magic1) ) TrailingStop(_tp);
}
//
if(_IsStopLoss_0)
StopLoss_0(_StopLoss_0_From);
//
return(0);
}


//=++============================================ =================++=
double DoubleTestZero(double value, double new_value)
{
if(value==0) return(value);
else return(new_value);
}


//=++============================================ =================++=
double ND(double value)
{
return( NormalizeDouble(value, _Digits) );
}


//=++============================================ =================++=
// closing orders. End on close all
void OrdersDeleteAll(int cmd)
{
while(CountOrders(cmd) > 0)
{
for(int i = OrdersTotal() - 1; i >= 0 ; i--)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if( (OrderSymbol() == _Symbol)
&& (OrderMagicNumber() == _Magic1 || OrderMagicNumber() == _Magic2)
&& (OrderType() == cmd) )
{
if(OrderType() == OP_BUY)
if(!OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), _Slippage, CLR_NONE))
Print("v128-2 > ", _Symbol, " > BUY -> ticket=", OrderTicket(),
" -> Error (closing) #", GetLastError());
if(OrderType() == OP_SELL)
if(!OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), _Slippage, CLR_NONE))
Print("v128-2 > ", _Symbol, " > SELL -> ticket=", OrderTicket(),
" -> Error (closing) #", GetLastError());
}
}
}

}

}



//=++============================================ =================++=
// counting the number of orders in the direction
int CountOrders(int cmd)
{
int n = 0;
for(int i = OrdersTotal() - 1; i >= 0 ; i--)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if( (OrderSymbol() == _Symbol)
&& (OrderMagicNumber() == _Magic1 || OrderMagicNumber() == _Magic2)
&& (OrderType() == cmd) ) n++;
}
}
return(n);
}


//=++============================================ =================++=
// search for an order by magic
bool FindOrders(int magic)
{
for(int i = OrdersTotal() - 1; i >= 0 ; i--)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if( (OrderSymbol() == _Symbol) && (OrderMagicNumber() == magic) )
return(true);
}
}
return(false);
}


//=++============================================ =================++=
// working out the breakeven level by magic
void StopLoss_0(int from)
{
double profit point, bid, ask;
bool is;
double P3_buy, P3_sell;
//
for(int i = OrdersTotal() - 1; i >= 0 ; i--)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if(!( (OrderSymbol() == _Symbol) && (OrderMagicNumber() == _Magic1 || OrderMagicNumber() == _Magic2) )) continue;
//
if(OrderType() == OP_BUY)
{
bid = MarketInfo(_Symbol, MODE_BID);
profitpoint = (bid - OrderOpenPrice()) / _Point;
is = profitpoint >= _StopLoss_0_Level + from;
P3_buy = ND( OrderOpenPrice() + from * _Point );
//
if( is && ( OrderStopLoss() == 0 || OrderStopLoss() < P3_buy ) )
{
Print("v128-2 b4 >", _Symbol, " | ", _Timeframe,
" -> Bid=", MarketInfo(_Symbol, MODE_BID),
" | p/o=", OrderOpenPrice(), " | s/l=", OrderStopLoss(), " | P3_buy=", P3_buy,
" | d=", _StopLoss_0_Level, " | profitpoint=", profitpoint);
if(!OrderModify(OrderTicket(), OrderOpenPrice(), P3_buy, OrderTakeProfit(), 0, CLR_NONE))
Print("v128-2 b4 > ", _Symbol, " | ", _Timeframe,
" -> BUY > ticket=", OrderTicket(), " > Error (breakeven) #", GetLastError());
}
}
//
else if(OrderType() == OP_SELL)
{
ask = MarketInfo(_Symbol, MODE_ASK);
profitpoint = (OrderOpenPrice() - ask) / _Point;
is = profitpoint >= _StopLoss_0_Level + from;
P3_sell = ND( OrderOpenPrice() - from * _Point );
//
if( is && ( OrderStopLoss() == 0 || OrderStopLoss() > P3_sell ) )
{
Print("v128-2 b4 >", _Symbol, " | ", _Timeframe,
" -> Ask =", MarketInfo(_Symbol, MODE_ASK),
" | p/o=", OrderOpenPrice(), " | s/l=", OrderStopLoss(), " | P3_sell=", P3_sell,
" | d=", _StopLoss_0_Level, " | profitpoint=", profitpoint);
if(!OrderModify(OrderTicket(), OrderOpenPrice(), P3_sell, OrderTakeProfit(), 0, CLR_NONE))
Print("v128-2 b4 > ", _Symbol, " | ", _Timeframe,
" -> SELL -> ticket=", OrderTicket(), " > Error (breakeven) #", GetLastError());
}
}
}
}
}


//=++============================================ =================++=
// working out the trailing stop by magic
void TrailingStop(int from)
{
double profit point, bid, ask;
double fromprice;
//
for(int i = OrdersTotal() - 1; i >= 0 ; i--)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if(!( (OrderSymbol() == _Symbol) && (OrderMagicNumber() == _Magic1 || OrderMagicNumber() == _Magic2) )) continue;
//
if(OrderType() == OP_BUY)
{
if(_IsTrailingStopProfit) fromprice = OrderOpenPrice() + from * _Point;
else fromprice = OrderStopLoss();
//
bid = MarketInfo(_Symbol, MODE_BID);
profitpoint = (bid - ND(fromprice)) / _Point;
//
if( profitpoint >= _TrailingStopLevel &&
bid > (OrderStopLoss() + (_TrailingStopLevel + _TrailingStopStep) * _Point) )
{
Print("v128-2 v4 >", _Symbol, " | ", _Timeframe,
" -> Bid=", MarketInfo(_Symbol, MODE_BID),
" | p/o=", OrderOpenPrice(), " | s/l=", OrderStopLoss(),
" | d=", _TrailingStopLevel, " | profitpoint=", profitpoint);
if(!OrderModify(OrderTicket(), OrderOpenPrice(), ND(bid - (_TrailingStopLevel) * _Point),
OrderTakeProfit(), 0, CLR_NONE))
{
Print("v128-2 v4 >", _Symbol, " | ", _Timeframe,
" -> BUY > ticket=", OrderTicket(), " > Error (trailing stop) #", GetLastError());
}
}
}
//
else if(OrderType() == OP_SELL)
{
if(_IsTrailingStopProfit) fromprice = OrderOpenPrice() - from * _Point;
else fromprice = OrderStopLoss();
//
ask = MarketInfo(_Symbol, MODE_ASK);
profitpoint = (ND(fromprice) - ask) / _Point;
//
if( profitpoint >= _TrailingStopLevel &&
ask < (OrderStopLoss() - (_TrailingStopLevel + _TrailingStopStep) * _Point) )
{
Print("v128-2 v4 >", _Symbol, " | ", _Timeframe,
" -> Ask=", MarketInfo(_Symbol, MODE_ASK),
" | p/o=", OrderOpenPrice(), " | s/l=", OrderStopLoss(),
" | d=", _TrailingStopLevel, " | profitpoint=", profitpoint);
if(!OrderModify(OrderTicket(), OrderOpenPrice(), ND(ask + (_TrailingStopLevel) * _Point),
OrderTakeProfit(), 0, CLR_NONE))
{
Print("v128-2 v4 >", _Symbol, " | ", _Timeframe,
" -> SELL > ticket=", OrderTicket(), " > Error (trailing stop) #", GetLastError());
}
}
}
}
}
}


//=++============================================ =================++=
// Finding the local bottom. Returns the price
double FindPriceMinMax(bool isUp)
{
int shift = 1;
double price = 0, p0,p1,p2;
while(price == 0)
{
p0 = iCustom(_Symbol, _Timeframe, "ZigZag", _ZZ_ExtDepth, _ZZ_ExtDeviation, _ZZ_ExtBackstep, 0, shift);
p1 = iCustom(_Symbol, _Timeframe, "ZigZag", _ZZ_ExtDepth, _ZZ_ExtDeviation, _ZZ_ExtBackstep, 1, shift);
p2 = iCustom(_Symbol, _Timeframe, "ZigZag", _ZZ_ExtDepth, _ZZ_ExtDeviation, _ZZ_ExtBackstep, 2, shift);
//Print("v128-2 >", _Symbol, " | ", _Timeframe,
// " > sift=", shift, " | p0=", p0, " | p1=", p1, " | p2=", p2);
if(isUp)
{
if(p0 !=0 && p0 == p1) // vertex found
price = p0;
}
else
{
if(p0 != 0 && p0 == p2) // bottom found
price = p0;
}
shift++;
}
//Print("v128-2 >", _Symbol, " | ", _Timeframe,
// " -> return(price)=", price);
return(price);
}


//=============================================== =====================
// Read variable from file.
// If the file does not exist, create a file and write the variable to the file
double _FileReadWriteDouble(string filename, double value)
{
int h1 = FileOpen(filename, FILE_BIN);
if(h1 > 0)
{
value = FileReadDouble(h1, DOUBLE_VALUE);
FileClose(h1);
}
else
{
h1 = FileOpen(filename, FILE_BIN|FILE_WRITE);
FileWriteDouble(h1, value, DOUBLE_VALUE);
FileClose(h1);
}
return(value);
}


//=============================================== =====================
// Write variable to file
void _FileWriteDouble(string filename, double value)
{
int h1 = FileOpen(filename, FILE_BIN|FILE_WRITE);
FileWriteDouble(h1, value, DOUBLE_VALUE);
FileClose(h1);

}

 
Vitalie Postolache:

In the code you showed above, the reference is to the current TF, so what are we talking about? If you are referring to M5 from W1, then write it that way.

If you work with the current timeframe, then the close price is floating on zero bar, and on the rest - only one Close price, not many, how do you build a histogram on one value, I do not understand.

If you want to draw an image, use the icon buttons at the top of edit box, there are a lot of useful buttons there, I suggest to learn.

I'm asking how to get the maximum and minimum readings of the indicator in the current timeframe during the current one,

If you think I'm lazy and don't want to look for pictures, no. But I still can't do it. I right-click on the chart in the terminal (Insta) - Save as picture - Active chart as is - transferred to MKL5 (the same terminal picture is displayed there) - bottom line bbCode (I select and copy the code), then I insert this code in the message, after I send the message, there should be a picture in the message(this forum does not have one but displays only the code text), I tried to use the "Pictures" button (Ctrl+Alt+l) to select the file and the downloaded code cannot be pasted in this line, without screenshots you will not understand.


 
vitek2010:

I'm asking how to get the minimum and maximum indicator readings on the current timeframe during the current one, I gave screenshots as an example,

If you think I'm lazy and don't want to look for pictures, no. But I still can't do it. I right-click on the chart in the terminal (Insta) - Save as picture - Active chart as is - transferred to MKL5 (the same terminal picture is displayed there) - bottom line bbCode (I select and copy the code), then I insert this code in the message, after I send the message, there should be a picture in the message(in this forum it is not present and only the code text is displayed), I have tried using the " Picture (Ctrl+Alt+l) button and it needs to select the file and the downloaded code is not pasted in this column, and you will not understand without screenshots.

Instead of the file name on the local computer, you can insert a link, right in the same line, where they write the file name, everything works. Like this

It is also possible to insert a link in the message, but without tags, on this forum tags do not work. Like this.

As for getting prices from a smaller TF, there's CopyRates and similar functions for each price individually.

It is copied to the array, then in the loop the time is compared to the time of a candle of a higher TF, if the lower candle fits, then the price is counted in the indicator.
 
Is there any way to see the indicator drawings in the tester, because the graph shows something I missed
Files:
Tester11.gif  18 kb
 
trader781:
Can you see the indicator drawings in the tester, because judging by the chart I missed something there?

In the tester, there is an"Open graph" button. I wonder what it's for?

Or the "Visualization" checkbox.

 
Vitalie Postolache:

In the tester, there is an"Open graph" button. I wonder what it's for?

Or the "Visualisation" checkbox.

I mean, while the chart is scrolling, there are no indices there
 
trader781:
I mean, while the chart is scrolling, there's no turkeys there.
There never were. You set them by hand when you need them. The test to pause, the indicator to the chart, then you rotate it.
Reason: