I found this code on the forum, dates back to a few years ago, I have optimized it for the current period; thanks to the code writer, I can’t remember the name, he works on the timeframe at 10seconds, with a very fast take profit to have a linear gain curve, he also works only in periods of time (9-17.30) when the spread is low ( 1.2)
if you can optimize it still write directly here on the forum, I sent it to test today, and already managed to earn 50 euros in less than 4 hours,
Thank you
Alex
//SPEAD = 2.5
//Capital = £500
//Trading hours from DAX open until NYSE close. No after hours trading.
//Time is UTC +2 (South Afica time)
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 090000
timeEnterBefore = time >= noEntryBeforeTime
// Prevents the system from placing new orders to enter the market or increase position size after the specified time
noEntryAfterTime = 173000
timeEnterAfter = time < noEntryAfterTime
// Conditions to enter long positions
indicator1 = WeightedAverage[25](totalPrice)
c1 = (High CROSSES OVER indicator1)
indicator2 = WeightedAverage[79](totalPrice)
c2 = (low CROSSES OVER indicator2)
IF (c1 AND c2) AND timeEnterBefore AND timeEnterAfter THEN
Buy 1 CONTRACT AT MARKET
ENDIF
indicator3 = WeightedAverage[25](totalPrice)
c3 = (low CROSSES UNDER indicator3)
indicator4 = WeightedAverage[79](totalPrice)
c4 = (High CROSSES UNDER indicator4)
IF (c3 AND c4) AND timeEnterBefore AND timeEnterAfter THEN
SellShort 1 CONTRACT AT MARKET
ENDIF
// Stops and targets
SET TARGET $PROFIT 9
Hi Alex, thanks for sharing. There is no stoploss in the strategy, only contrarian orders can close an order in a loss and therefore if it doesn’t happen it could lead on huge drawdown of your account. So any optimized values could also lead to the same equity curve, I’m sorry.
Hello nicolas,
thanks for the reply, i’m now working on the version with the stop loss; From monday he made 400 euros in germany 30(€5) that costs 3.2k (ig version); i’ll probably put a distante stoploss in the case the robot buy at a maximum or at a minium; working on the 10 sec the limit sales points are practically always touched; however, even a distant stoploss obviously has to be added for safety, i update you soon
Thanks
Alex
Hi Alex, if you don’t mind please update the strategy here with the new versions instead of posting them directly in the library, thanks 🙂
ok,thank you nicolas,
here you have a new version of the code, it always works on the 10sec dax
i’m now testing it with different x,y,z
i keep you update if i find the perfect Combination
//-------------------------------------------------------------------------
// Codice principale : nn si sa m.a. colorata bull
//-------------------------------------------------------------------------
//SPEAD = 2.5
//Capital = £500
//Trading hours from DAX open until NYSE close. No after hours trading.
//Time is UTC +2 (South Afica time)
DEFPARAM CumulateOrders = false // Cumulating positions deactivated
a=average[z] (close)
if a[1]<a then
alex=100
endif
if a[1] > a then
alex=50
endif
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 090000
timeEnterBefore = time >= noEntryBeforeTime
// Prevents the system from placing new orders to enter the market or increase position size after the specified time
noEntryAfterTime = 173000
timeEnterAfter = time < noEntryAfterTime
// Conditions to enter long positions
indicator1 = WeightedAverage[x](totalPrice)
c1 = (High CROSSES OVER indicator1)
indicator2 = WeightedAverage[y](totalPrice)
c2 = (low CROSSES OVER indicator2)
IF (c1 AND c2) AND timeEnterBefore AND timeEnterAfter and COUNTOFPOSITION=0 and alex=100 THEN
Buy 1 CONTRACT AT MARKET
ENDIF
indicator3 = WeightedAverage[x](totalPrice)
c3 = (low CROSSES UNDER indicator3)
indicator4 = WeightedAverage[y](totalPrice)
c4 = (High CROSSES UNDER indicator4)
IF (c3 AND c4) AND timeEnterBefore AND timeEnterAfter and COUNTOFPOSITION=0 and alex=50 THEN
SellShort 1 CONTRACT AT MARKET
ENDIF
// Stops and targets
SET TARGET $PROFIT 10
SET STOP $LOSS 200
thanks
Alex
How’s it going with this one alex20258?