Hello, I’m testing this sysetm on DJ and SP500. It takes frequent trades on DJ, but none on the SP500 (1euro/point). When I plot the Signals for SP500 on an indicator (screenshot below), I can see multiple Signals over the last few days, but no trades. I’m with IG… Orders are AT MARKET so it should work… Is there something linked to the broker settings? Position size, etc.
Any clue on what’s wrong please?
Thanks
-------------------------------------------------------------------------
// Code principal : 220225 SwingLine LMA
//-------------------------------------------------------------------------
DEFPARAM CUMULATEORDERS = FALSE
ONCE PTK = 3.0
ONCE SL = 0.3
ONCE STB = 24.0
ONCE TP = 1.7
ONCE periodLMA = 44.0
TIMEFRAME(1 hour)
//PRC_SwingLine Ron Black | indicator
if upsw=1 then
if high>hH then
hH=high
endif
if low>hL then
hL=low
endif
if high<hL then
upsw=0
lL=low
lH=high
endif
endif
if upsw=0 then
if low<lL then
lL=low
endif
if high<lH then
lH=high
endif
if low>lH then
upsw=1
hH=high
hL=low
endif
endif
if upsw=1 then
swingline=hL
else
swingline=lH
endif
LMA=2*weightedaverage[periodLMA](close)-average[periodLMA](close)
SmoothLMA=weightedaverage[periodLMA](LMA)
Long=0
Short=0
Long = close>open and close>close[1] and close>open[1] and close>hL and hL>hL[1] and close>LMA and LMA>LMA[1]
Short = close<open and close<close[1] and close<open[1] and close<lH and lH<lH[1] and close<LMA and LMA<LMA[1]
TIMEFRAME(DEFAULT)
nLots = round((2000+STRATEGYPROFIT)/(close*.5*.1),1)//round(33031/4258,1)
IF NOT LongOnMarket AND Long THEN
BUY nLots CONTRACTS AT MARKET
ENDIF
IF NOT ShortOnMarket AND Short THEN
SELLSHORT nLots CONTRACTS AT MARKET
ENDIF
// Conditions pour fermer une position acheteuse
If LongOnMarket AND Short THEN
SELL AT MARKET
SELLSHORT nLots CONTRACTS AT MARKET
ENDIF
IF ShortOnMarket AND Long THEN
EXITSHORT AT MARKET
BUY nLots CONTRACTS AT MARKET
ENDIF
// Stops et objectifs : entrez vos stops et vos objectifs ici
SET STOP %LOSS SL
SET TARGET %PROFIT TP
///2 BREAKEAVEN///////////
once breakeaven = 1//1 on - 0 off
//STB = 30//how much pips/points in gain to activate the breakeven function?
//PTK = 5 //how much pips/points to keep in profit above of below our entry price when the breakeven is activated (beware of spread)
startBreakeven = STB
PointsToKeep = PTK
Distance = 2.5
//reset the breakevenLevel when no trade are on market
if breakeaven>0 then
IF NOT ONMARKET THEN
breakevenLevel=0
ENDIF
// --- BUY SIDE ---
//test if the price have moved favourably of "startBreakeven" points already
IF LONGONMARKET AND close-positionprice>=startBreakeven*pipsize THEN
//calculate the breakevenLevel
breakevenLevel = positionprice+PointsToKeep*pipsize
ENDIF
//place the new stop orders on market at breakevenLevel
IF breakevenLevel>0 THEN
SELL AT (breakevenLevel-distance) STOP
ENDIF
// --- end of BUY SIDE ---
IF SHORTONMARKET AND positionprice-close>startBreakeven*pipsize THEN
//calculate the breakevenLevel
breakevenLevel = positionprice-PointsToKeep*pipsize
ENDIF
//place the new stop orders on market at breakevenLevel
IF breakevenLevel>0 THEN
EXITSHORT AT (breakevenLevel+distance) STOP
ENDIF
endif
Have you tried raising position size, i.e. from 1 to 2 or more?
Hi Grahal,
The current SP500 price is 4240. Initial position size is defined 2000eur/(close*.5*.1) = 9.4, so much higher than 1.
Thanks
For those who have the same problem… The issue is with the value per point.
With IG France, we have US 500 at 1eur/point, $50/point and $250/point. The Algos don’t seem to work on the first category (1eur/point), irrespective of the number of contracts. I tested on $50 and $250 and it works.
Does the 1 euro pp also does not trade with e.g. 5 contracts ? (or 50 to compare more realistically)
Btw, in the Netherlands we also have 250, 50 and 1. But yesterday I noticed that the 1 is somewhat harder to find ?
But yesterday I noticed that the 1 is somewhat harder to find ?
And the 1 is the one giving me the 500 error when backtesting with 1M history ??
(on your “Array” system, Khaled, with or without arrays)
Hi Peter, for 1 eur/contract, I tried two options:
- variable lot size : (2000+strategyprofit)/(close*.5*.1) –> 8 lots and more
- fixed at 10 contracts
and both don’t work at 1eur/contract. However, same Algo, works with $50 and $250.
with IG France, there is no 5eur/point.
Maybe IG is limiting data access on 1eur/pp because not profitable for them.
For the $50/pp contract, the min lot size allowed by IG France is 0.2.
Let’s say, you want to trade with 5000euros with US 500 price at 4400.
- 1eur/pp, you can trade 5000/(4400*.5*.1) = 22.7 lots
- $50/pp, you can trade 5000/(4400*.5*.1*50) = 0.45 lots (higher than the min of 0.2)
So the min required deposit to trade US500 with Algo is $2200 (4400*$50*.5*.1*.2), equivalent to 1964 euros
We can still trade US500 at 1eur/pp manually
Couldn’t it be related to the slippage somehow ?
I merely refer to a psychological thing, where with manual trading we would be able to directly see what we lose at the exit because of that, while with AutoTrading you wouldn’t understand a hoot of it, afterwards.
Otoh, not sure how the slippage would be different with higher values (more contracts).
Maybe IG is limiting data access on 1eur/pp because not profitable for them.
How can anything not be profitable when earning by the spread ? If it is payed by commission (where there’s a threshold) then alas.
Still there could be something like too much overhead (exchange etc. needs to be payed). But not with AutoTrade only …
… learning learning learning …