[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 417

 
okvseok:


well, for example, don't spin the mouse wheel (key) for 3 minutes left or right))), but just enter a specific bar date or something else.

Thank you for your answer!


Press the spacebar and enter the desired date.

The answer is as correct as it is useless. Totally relevant to the question.

 
TarasBY:
In the bottom left-hand corner of the graph (where the date is), double-click and in the window that opens, enter the desired date in DD.MM.YYYY format - is this "not handwritten" enough?
Yes, thank you very much. ok.
 
Run:

or in other words
the script is supposed to roughly write n number of lines, but it only writes one

For starters, move the file opening and closing procedure out of the loop.
 

Thank you, it's working.

  handle=FileOpen("AUDJPY.csv", FILE_READ|FILE_WRITE, '\t');
  for (int i=NumberOfCandels; i>0; i--) {
    arrowbuy = iCustom(NULL, 0, "xxx", 0, i);
    arrowsell = iCustom(NULL, 0, "xxx", 1, i);
    if(arrowbuy != EMPTY_VALUE && arrowsell == EMPTY_VALUE) {
      if(handle>0) {
        FileWrite(handle, TimeToStr(Time[i], TIME_DATE|TIME_MINUTES), " Buy");
        }
      }
    if(arrowsell != EMPTY_VALUE && arrowbuy == EMPTY_VALUE) {
      if(handle>0) {
        FileWrite(handle, TimeToStr(Time[i], TIME_DATE|TIME_MINUTES), " Sell");
        }
      }
  }
  FileClose(handle);
 
okvseok:


Well, for example, don't roll the mouse wheel (key) 3 minutes to the left or right))), but just enter a certain bar date or something else.

Thanks for the reply!

There is a function

int iBarShift( string symbol, int timeframe, datetime time, bool exact=false)
Searching for a bar by time. The function returns the offset of the bar to which the specified time belongs. If there is no bar for the specified time ("hole" in the history), the function returns, depending on the exact parameter, -1 or the offset of the nearest bar.
Parameters:
symbol - Symbol name of the instrument. NULL means current symbol.
timeframe - Period. Can be one of the timeframes of a chart. 0 means period of the current chart.
time - Time value to search for.
exact - Returned value if no bar is found. FALSE - iBarShift returns closest. TRUE - iBarShift returns -1.
Example:
 datetime some_time=D'2004.03.21 12:00'; int shift=iBarShift("EUROUSD",PERIOD_M1,some_time); Print("shift of bar with open time ",TimeToStr(some_time)," is ",shift);

 
Chiripaha:

: )))))))) (no notation... and no comment)

Of the two, the questioner and the answerer, it is more likely that you, the questioner, do not quite understand what happens to the pending orders when they are triggered. A pending order is executed at ANY price closest to it. The rule of thumb for a pending order is if the price has reached it, the trade will go into the market. And the price will not matter. This applies to Stop Losses as well, as they are also pending orders, only the opposite position of the trade itself. This is slightly different to trades on the exchange. Perhaps that is why you are confused.

In this sense a lot depends on the quality of the broker. By that we mean both the regulations for executing trades, and the availability of liquidity at that broker, and perhaps a bunch of other features: presumably honesty, etc... If you read the contract with almost any forex broker (DC), it turns out that your transaction (and any other trader) can close at any convenient price of this "broker" and it will be within the law and the regulations, because you have signed it. - But those are other topics. It has nothing to do with programming.


If you have a robot on the demo, everything usually opens properly there to attract people. And, again, I repeat, the orders that have been opened manually have opened in the place where they have been set!
 
Ekburg:

As for the forex broker, I don't have a clear picture, but I've traded on the demo. And, again, I repeat, the orders that have been opened manually have opened where they have been set!

Bottom line: Of course, you could, for the sake of interest, ask you to describe the conditions in more detail, since you have only provided a general description: when were the robot orders set (in advance or not; manual around the same time as the robot or not, etc.). But anyway, even in this case you will only have to deal with your broker, because he has his own thread which probably queues up the trades. Suppose, if the manual pending order was placed first, then the time of its execution will be different (including the queue of other clients), so the price may be different. If the robot has placed the orders within the period of formed signals, then the arrival of orders in the queue is not evident - hence the possible bias in the execution price. Also, it may be affected by the size of positions that you don't write anything about... etc...

But... all the same, this can only be clarified with a broker (DC). And I assume he will find a bunch of reasons I didn't mention. - And the advice was right: the log in your hands and to the broker, unless of course you still think your pending orders have moved. But just do not confuse 2 different concepts: a Pending Order and a Deal on this Pending Order. The Limit order is an instruction to enter the market at any nearest price with declared volume. And the Deal - is the price at which it was possible to execute your order for the declared volume of money (lot). - And the prices of these orders are likely to be different (especially on the fast market, which is what you were given the link to). In the case of a limit order, the price of the order and the price of the execution are equal (by definition).

And the fact that the demo and the real orders of the broker do not differ is good! - This shows that the broker does not fake trades to attract clients (as you say). - There is no discrepancy to be seen in this case.

 
Zhunko:

1. How did you start? You have to run it without updating first. I.e. IsRefreshRates = false. The data will not be updated.

2. Then you must run it with IsRefreshRates = true. The data will be updated.

Here's a screenshot 1: screenshot 2:

Note the bar times. You can also see that MarketInfo() takes data from the market overview.

Here is the Expert Advisor. I corrected it a little. Ticked off instrument name.


1. I used one terminal no matter how, with or without update, the screen is the same! I downloaded the terminal together with scripts for the test with 99% of quotation from Dookie. I poured them in as it won't attach due to oversize. Here is the link:http://www.load.to/PqWVW2JQ75/Тиковые_котировки_для_тестера_MT4_от_DukasCopy.zip

2. In any other terminal the situation is already different. Here on Oanda, for example:

2.1 Initially in case:

IsRefreshRates = false

So:

2.2 Further in case:

IsRefreshRates = true

like this.

As you can see in the first mode, the prices are far from the AUDNZD pair... and in the second mode the prices are exactly what we want to see...

It turns out that still RefreshRates() "pulls" quotes from the server. The support is asleep, so this variant is closer than the original one.

 
Zhunko:
RefreshRates() only updates what the expert is working with. That's how it finds out. From the expert. Long time ago someone from Metakvot wrote about it.


Vadim, I doubt that RefreshRates() is aware of what tools the Expert Advisor needs. Not all Expert Advisors have a tool name defined in global parameters, don't they? Well... If so, it begs the question, on what basisRefreshRates() knows what tool's market data must be updated and what must not be updated?
 
Integer:

Junko, page 409, the very bottom post - it says why the data is updated. Because iOpen(), iClose() are called, and you prove that from RefreshRates(). The first time the script was run without RefreshRates(), but iOpen() and iClose() functions were called, and from this the terminal loads the data. On the second run the data was already there and we know that zero bar is loaded first, so the impression is that the data is all loaded, but it may not be all loaded, but it may be in process.

...And yet you prove that you've figured out the data loading.... what streams and synchronisations can we be talking about here...


Why wouldiOpen() pull data from the server? It's written in the documentation that it returns a value... So it's returning, not downloading.
Reason: