| || |
11-10-2011, 06:15 AM #121
The code contains lots of stuff like this...
which will work fine on Forex, the + 0.0020 means 20 pips. But this is not ok for CFDs (also not for JPY) because a pip on SPX500 for example is not 0.0001. So, the problem was that the stops/limits were being place much too close to the price, and they would trigger immediately.
buyStop.Generate(StrategyInfo.AvgEntryPrice + 0.0020);
The "usual" method to convert from pips to price is to do this...
Which converts the pips to price using x10, is because Bars.Point is the value of a fractional pip (i.e. 0.00001 on EUR/USD for example).
buyStop.Generate(StrategyInfo.AvgEntryPrice + 20 * (10 * Bars.Point));
This should change now work for your SPX500 CFD
However, unfortunately, this is not the end of the story, because most CFDs do not have factional pip pricing, e.g. UK100, and there doesn't seem any easy way to work around this other than having a lookup function which finds out if the conversion should be x10 or x1
11-20-2011, 11:54 PM #122
If a stEA calculates/determines position-size/numlot according to say Balance and the account setting performs rollover (auto position reset, close/open) midnight/close of market - whatever the time that happens everyday.
If on a particular day a position is in the money such that position-size calculation/result would raise from say one to two; when rollover is performed is this change effected; do we see the new position change from one numlot to two numlots or would rollover never have anything to do with changing such things as position-size and is only concerned with rollover of position "as is" leaving all other factors constant?
11-21-2011, 12:07 AM #123
It won't change the position size of a open position. But you can generate extra lot with another order to handle this situation.
11-21-2011, 12:44 AM #124
In vain have I waited for a response to post #116 ... why is this?
11-21-2011, 12:56 AM #125
Please note that we are no longer providing free coding request on this forum. All this kind of request are with the lowest priority. Please consult our programming service if you want a immediate response.
Forex Programming Services | Custom MT4 Strategy Programming
12-16-2011, 11:05 AM #126
Whatever Data Range 100, 500, 1000 Bars Back I set SWE30 doesn't get me the required bars - see image attached, thereby by failing attachment of both Indicators and Strategy Advisors due to "Not enough series length." Kindly advise.
12-20-2011, 04:33 AM #127
Thanks for reporting. We are aware of this issue. SUI30, UKOil have the same problem getting historical data.
Disclaimer: Trading foreign exchange on margin carries a high level of risk, and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with foreign exchange trading, and seek advice from an independent financial advisor if you have any doubts. Any opinions, news, research, analyses, prices, or other information contained on this website is provided as general market commentary and does not constitute investment advice. Forex Capital Markets LLC. will not accept liability for any loss or damage, including without limitation to, any loss of profit, which may arise directly or indirectly from use of or reliance on such information.