Special Features of Optimization Process
|
---|
See Testing Features and Limits in MetaTrader 4
Special Features of Optimization Process
|
---|
So the code looks correct, then?
I believe I didn't run the test with Optimization being on.
I just want to make sure that I got the "Take Profit" Parameter correct in OrderSend. If that's how it would be done to translate the Price that the Fib Level is at into a double?
At opening of a market order (OP_SELL or OP_BUY), only the latest prices of Bid (for selling) or Ask (for buying) can be used as open price. If operation is performed with a security differing from the current one, the MarketInfo() function must be used with MODE_BID or MODE_ASK parameter for the latest quotes for this security to be obtained. Calculated or unnormalized price cannot be applied. If there has not been the requested open price in the price thread or it has not been normalized according to the amount of digits after decimal point, the error 129 (ERR_INVALID_PRICE) will be generated. If the requested open price is fully out of date, the error 138 (ERR_REQUOTE) will be generated independently on the slippage parameter. If the requested price is out of date, but present in the thread, the position will be opened at the current price and only if the current price lies within the range of price+-slippage. |
---|
I think I figured out the problem, but I'm not sure how to fix it-
ObjectSetFiboDescription("FibHigh", 7, "%$");That piece of the code changed the 7th fib. level (268.1) to the current price it is set at. Rather then leaving the default label "268.1", I changed the description to "%$" which allows the price to be shown on the chart window I'm looking at.
So I thought, when I would do-
ObjectGetFiboDescription("FibHigh",7);That would pull up the price, rather then "%$", being that it changes the description on the chart window.
However- when I made a test code, which was this:
double MAHigh, MAClose, MALow; MAHigh = iMA(NULL,0,34,0,MODE_SMA,PRICE_HIGH,0); MAClose = iMA(NULL,0,34,0,MODE_SMA,PRICE_CLOSE,0); MALow = iMA(NULL,0,34,0,MODE_SMA,PRICE_LOW,0); ObjectCreate("FibHigh", OBJ_FIBO, 0, 0, MAHigh, 0, MAClose); ObjectSetFiboDescription("FibHigh",7,"%$"); Print(ObjectGetFiboDescription("FibHigh",7));The Expert Printed "%$", even though the chart showed the 268.1 fib level as 1.3608 (which was the current price).
So the question NOW is either- How do I get the price rather then "%$"?
Or is there another way rather then ObjectGetFiboDescription to get the price that the 268.1 level is at?
-J
Fibo_0=ObjectGet("FibHigh",OBJPROP_PRICE1); Fibo_100=ObjectGet("FibHigh",OBJPROP_PRICE2); ... Fibo_N_percent=(Fibo_100-Fibo_0)*N/100+Fibo_0;
Try this solution:
Fibo_0=ObjectGet("FibHigh",OBJPROP_PRICE1); Fibo_100=ObjectGet("FibHigh",OBJPROP_PRICE2); ... Fibo_N_percent=(Fibo_100-Fibo_0)*N/100+Fibo_0;
What does N mean? in N/100- It is giving me a error message that N is not defined.
Nevermind. I can figure out what N means with Algebra.
Actually though- it didn't work at first....
But then I tried:
Fibo_0H=ObjectGet("FibHigh",OBJPROP_PRICE1); Fibo_100H=ObjectGet("FibHigh",OBJPROP_PRICE2); Fibo_N_percent1=(Fibo_100H-Fibo_0H)*7/100+Fibo_0H; DoubleToStr(Fibo_N_percent1,4); Buy = Fibo_N_percent1;And for some reason that worked. So I think I'm good.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
-J