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

 

Hi all!!!

I decided to check how many plus closes within the next 9 bars, after a bar with a range of 0.007, with a close on a bar greater than the open (1 hour EURUSD chart).

I made a script to get the following data:

how many profitable ranges up EURUSD,H1: total studied bars=50000

how many profitable ranges are moving up EURUSD,H1: average number of points at the close on the plus side=0.008308835489833627

how many profitable ranges up EURUSD,H1: how many closes in the plus after 9 close bars=541

how many profitable ranges up EURUSD,H1: total number of points in profit=4.495079999999993

how many profitable ranges up EURUSD,H1: total number of bars with this range=622

I start the Expert Advisor and obtain quite different data. The Expert Advisor enters after the signal bar and exits on a profit after 700 or 9 bars. Stop has been set to an unreachable value and spread is zero.

Considering that we have approximately 250 working days, we obtain 6000 hours.

That is, 8 years is 50,000 hour bars, by number of trades the approximate range for research: 2006 June to the current date.

Profitable trades in the EA:

2014.11.04 13:48:21.946 2014.10.31 22:56 profitable ranges up OnTester returns 391.000000000000000000

The number of trades is 630.

Explain why such discrepancies between EA and script?

Files:
 

Hi all.

How would the code for this function be?

A trade is opened and after 3 or 10 minutes it is closed

OrderSend(Symbol(), OP_SELL, 0.5, Bid, 1, Bid+0.00300, Bid-0.00300);

 

How does the terminal calculate the margin?

In the informer I did this:

        double _Expertmargin = 0.0;

        for ( int z = OrdersTotal() - 1; z >= 0; z -- )
        {
                if ( !OrderSelect( z, SELECT_BY_POS ) )
                {
                        _GetLastError = GetLastError();
                        Print(". OrderSelect("+ IntegerToString(z)+ ", SELECT_BY_POS ) - Error #"+ IntegerToString(_GetLastError) );
                }
                if ( OrderMagicNumber() == magic && OrderSymbol() == Symbol() && OrderType()<2)
                {
                        _Expertmargin += MarketInfo(Symbol(),MODE_MARGINREQUIRED)*OrderLots();
                }
        }

Then added up the margin values for each symbol and got some discrepancy with what AccountMargin() returns - 247.74 vs 247.79 in the terminal:


How is that so?

 

I want to create owls that trade on two pairs variable on EURUSD main chart

A_open = NormalizeDouble(iOpen(NULL, PERIOD_H1, 0), Digits);

it works perfectly, the second one for GBPUSD

double B_open = NormalizeDouble(iOpen(GBPUSD, PERIOD_H1, 0),Digits); it does not even see what I am doing wrong

 
Help, please! Maybe someone has seen either part of the code, or a script, or an Expert Advisor on the following principle. We put 2 pending orders (Buy Stop and Sell Stop), when one triggers, the second one is deleted and in its place we put the same one but with double lot. When the second pending order triggers, in place of the first one, another pending order with tripled lot is placed. I hope I wrote it clearly. Thank you.
 
prom18:
Help, please! Maybe someone has met either part of the code, or a script, or an EA on the following principle. We put 2 pending orders (buy and sell), when one triggered, the second is removed and in its place is set the same but with double lot. When the second pending order triggers, the first one is also placed in place of the first one with tripled lot. I hope I have written it clearly. Thank you.
Would you like to take a loss on your martin too?
 
Good afternoon! I am a newbie. I have been trying to learn how to write EAs for a month now, but I am having a hard time with it all. Please help me. Please write a separate EA for pending BuyStop,Sellstop,BuyLimit,SellLimit orders.
 
I want to understand the difference in writing an EA on all these pending orders? What parameters should be applied there?
 
logut:
I want to understand the difference in writing an EA on all these pending orders? What parameters should be applied there?

The documentation will help you

 
Vinin:

The documentation will help you

Reread the whole thing several times, don't understand what to enter
Reason: