Hi Guys,
This may be in the wrong spot but im hoping someone can help with an issue i keep getting on my demo account. I have made a rudimentary code that is not finished by any stretch but i wanted to try it out anyway & see how often it triggers live as the testing was throwing odd errors.
The issue is that it always stops the system with a rejection saying that the account needs more cash. I get that its a funding issue but i don’t see why it is buying such a large number of contracts to create rejection when it is set to buy only 1 & have tight stop/profit.
I also noticed that it trying to buy well above “atmarket” price.
Admin, please remove/move if not in correct location.
thanks in advance.
//-0-------------0-------------0-------------0-------------0-------------0------------
DEFPARAM CumulateOrders = false // Cumulating positions deactivated
//Trigger to enter position (all other criteria must be met)
//current time frame
//base moving average indicator percentages 3 candle look back
Ind1 = Average[15] (close[3])
Ind2 = Average[20] (close[3])
//moving average current candle
Ind5 = Average[15] (close)
Ind6 = Average[20] (close)
//get distance from averages in percentage relative to one above or below
DistPer1 = abs(Ind1-Ind2)*100/Ind1
DistPer2 = abs(Ind5-Ind6)*100/Ind5
c1 = (DistPer2-DistPer1)
// Conditions to enter long positions
IF c1 >= .02 THEN
BUY 1 CONTRACTS AT MARKET
ENDIF
// Stops and targets : Enter your protection stops and profit targets here
SET TARGET PROFIT 25
SET STOP LOSS 10
It’s definitely NOT a tight stop!
10 is NOT 10 pips, but a price difference, which means that a trade entere at 0.7777 will have a SL set at -19.xxx (so it will be disabled).
But don’t worry, it’s just a mettere of a couple of p‘s, replace lines 31 and 32 with:
SET TARGET pPROFIT 25
SET STOP pLOSS 10
the leading “p” means pips, if it’s missing then a price difference is assumed, so 10 would be considerend a price difference of 10.0000 (100K pips).
Thanks Roberto, im still learning the ins & outs of pro real code. Such subtle differences 😉