[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 600

 
evillive: It couldn't be simpler, could it?

I guess it is. Told you - I'm a dummie, I'm a dummie... The profit in the upper line is shown in pips, only in 3-digits:


As far as I understood, PipProfit = USDprofit/lot/Point for EURUSD. For pairs with a reverse quote, we need to take the difference of the opening price and the current price and multiply by Digits: Pips = OrderOpenPrice()-Bid*Digits_coefficient; where
Digits_coefficient = MathPow(10,Digits);

You don't have to take the difference, there's the OrderProfit() function.

Let's go over it again to get it stuck in your brain. So, let's buy GBPJPY.

1. OrderProfit() equals -15.27 USD = -1228.32 JPY (for conversion to yen, multiply by USDJPY rate).

2. Dividing the profit by the lot, equal to 0.1.

3. We divide the result by the price of 1 pip of 1 lot, equal to 0.01 JPY * 100000 = 1000 JPY. We obtain -12.28 points, i.e. as it is necessary.

This is a subtle error, as the figures are not taken at one and the same moment in time, but the Yen is strengthening sharply.

Formula for XXXYYY:

pips = ( USDYYY or 1/YYYUSD ) * OrderProfit() / ( OrderLots( ) * Point ).

Here Point is the point price of 1 lot in YYYY currency, equal to 100000 * MathPow( 10, - Digits ).

 

Good afternoon.

What could be the reasons why the EA is not optimised?

There is one optimised parameter, indicators are standard.

The test is running normally.

 
DOCTORS:

Can you give me a hint?

The script closes overlapping orders... But there is a catch - for some reason it does not close orders with different lot size...

Can you tell us where the problem is?


First, replace the direction of check with

for(int i=1; i<=OrdersTotal(); i++) // loop the order

at

for(int i=OrdersTotal() - 1; i>=0; i--) // Order loop


everywhere

 
sting-igor:

Why do some EAs work well in the tester first and then do not open a single trade? I do not remember the names of the EAs, but I had three of them, maybe I am doing something wrong? mt4

If your EA is wrongly written, it may perform a division by zero and then stop working. Look in the log for ZeroDevide error...
 
ilunga:

Well, for starters, replace the check direction with

for(int i=1; i<=OrdersTotal(); i++) // Order loop

at

for(int i=OrdersTotal() - 1; i>=0; i++) // Order loop


everywhere


Withdrawn, as the script was extremely incorrect... A lot to do... I wanted it to overlap the trades to zero... but it just overlapped... Thanks a lot for your help... ...when I do the zero overlap, I'll post it for questions.
 

Mathemat, if you only need the number of pips in profit/loss you can calculate in an even simpler way, I was just asleep yesterday when I wrote it )))

They seem to be universal formulas, suitable for all currency pairs:

double tickvalue = MarketInfo(OrderSymbol(),MODE_POINT); //если нужно значение тика для инструмента в окне которого установлен эксперт, то просто используем Point в дальнейшем

Pips = (OrderOpenPrice()-Ask)/tickvalue; // order short

Pips = (Bid - OrderOpenPrice())/tickvalue; // order long

.

 

Gentlemen, please help.

I need a function that checks if the price has touched the wrist during the last X bars?

Please don't kick me too hard, as I'm a complete dummie.

 

How to rewrite Awesome indicator for 1H only. Suppose I attach Awesome to 4H, I want the indicator to display data related to 1H and not to 4H.

//---- name for DataWindow and indicator subwindow label
IndicatorShortName("AO");
SetIndexLabel(1,NULL);
SetIndexLabel(2,NULL);

ExtBuffer0[i]=iMA(NULL,0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA(NULL,0,34,0,MODE_SMA,PRICE_MEDIAN,i);

I change NULL to PeriodH1, but it doesn't help.

 
flintz:

How to rewrite Awesome indicator for 1H only. Suppose I attach Awesome to 4H, I want indicator to display data related to 1H and not to 4H.

//---- name for DataWindow and indicator subwindow label
IndicatorShortName("AO");
SetIndexLabel(1,NULL);
SetIndexLabel(2,NULL);

ExtBuffer0[i]=iMA(NULL,0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA(NULL,0,34,0,MODE_SMA,PRICE_MEDIAN,i);

I change NULL to PeriodH1, but it doesn't help.

Change from NULL to "0" (the parameter next to NULL).
 
Thank you !!!