[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 210

 
Gentlemen, is there any tricky way to cause an error when opening or closing an order, I want to check the error handling block, three weeks on the Demo, and not a single error, or what else can be a workaround?
 

Stops can be set that are lower than those permitted by the BC

Then error 130 will be generated when opening a position (unless this error is automatically corrected in the code)

 
Dimoncheg >> :
I want to check the error handler, I've been working with the Demo for three weeks, but no errors, or is there something else that I can do?


It depends on what exactly you need and what error you want to catch...

I don't know about closing, but if we want to get an opening error we have the following options:

1. open with super-small lot for this instrument;

2. to open with an extremely large lot for this instrument;

3. open on the instrument that is not traded in DC. 4;

Open at a price that does not correspond to the order type. 5;

5. Open closer than the minimum distance from the current price;

6. Incorrect calculation of TP and/or SL;

7. And other similar options.


PS

On a close, I can't think of any other way round except to give the "absolutely left" ticker as a parameter (which cannot exist anyway)...

 

The essence of the problem is that it is necessary to reflect in colour the current value.

Namely - opening - 1.0 (as an example), it changes - 1.1 (i.e. increase - reflection - green)

Further - 1.0 (return to the initial - white) 0.99 (decrease - red).

I.e. the indicator historically reflects in one colour (say, white), and its current state changes colour

Depending on its current value (position relative to the axis - 0 is not taken into account)

Thank you

Files:
td.rar  1 kb
 
I have a question! When we have an EA on a chart and we change the timeframe on the same chart, then we deinitialise the EA on the old timeframe and initialise it on the new one ????
 
rid, Interesting Благодарю
 
artsnz >> :
I have a question! When we have an EA on a chart and we change timeframes on the same chart, then we deinitialise the EA on the old timeframe and initialise it on the new one????

Questions like this can easily be answered by looking in the "Experts" tab in the terminal.

P.S. Regarding your question, yes.

 
How do I write this comparison in the indicator code - one MA on the zero bar is greater than the maximum value of another MA from several periods ago? In the picture you can see when point 1 is greater than point 2. How to write this in the code?
 

Question to Professionals . Help me to output the MACDSample (standard in the terminal) into external variables of the MACD setting itself.

FastEMA
SlowEMA
SignalSMA

I am not able to change it but it doesn't work. Many thanks in advance.

Files:
 
govanvi >> :
How to write this comparison in the indicator code - one МА on zero bar is bigger than maximal value of another МА in some periods before? On the picture you can see when point 1 is higher than point 2. How to write this in the code?

If the number of "periods back" is quite small I would use a series of

MathMax(MA[i+...], MA[i+1...]), otherwise for-cycle. I.e. first find out the maximum value for MA1 on a segment you define,

and then compare it with value of second MA2.

Reason: