Rank: Advanced Member
Groups: Moderators, Registered, Registered Users, Subscribers Joined: 10/8/2010(UTC) Posts: 1,960
Thanks: 92 times Was thanked: 155 time(s) in 150 post(s)
|
Domenico D’Errico & Giovanni Trombetta's article, “Artificial Intelligence for System Development” presents a trading system created through genetic algorithms. The system is fully explained in their article and only the code is provided here. As designed, the system gives entry and exit signals to be acted upon on the following bar. The formulas below were written to look for the signal on the previous bar and then enact them on the current bar. The effect is the same but the logic is easier to implement. General tab: Name: Gandalf AI System Notes: Created by Roberto Giaccio.
Based on previous version by Giovanni Trombetta. Buy Order tab: Formula: Code:avgp:= (open + high + low + close)/4;
medp:= (high + low)/2;
medbp:= (open + close)/2;
entrySignal:=
(Ref(avgp < medp, -1) AND
ref(medp,-2) <= ref(avgp,-1) AND
ref(medbp,-2) <= ref(avgp, -3))
OR
(ref(avgp,-1) < ref(medp, -3) AND
ref(medbp,-1) < ref(medp, -2) AND
ref(medbp,-1) < ref(medbp, -2));
ref(entrySignal, -1)
Order Type: Limit Limit or Stop Price: Ref(low, -1) + 0.08 Entry Size: 10000 Expiration: Good for Day Sell Order tab: Formula: Code:avgp:= (open + high + low + close)/4;
medp:= (high + low)/2;
medbp:= (open + close)/2;
profit:= Simulation.CurrentPositionProfit;
time:= Simulation.CurrentPositionAge;
exitSignal:=
(profit >0 AND time >= 6) OR
(profit <=0 AND
(time >= 8)
OR
(Ref(avgp < medbp, -1) AND
ref(medp, -2) = ref(medbp, -3) AND
ref(medbp, -1) <= ref(medbp, -4))
OR
(ref(avgp,-2) < medbp AND
ref(medp,-4) <= ref(avgp,-3) AND
ref(medbp <= avgp, -1) )
OR
(ref(avgp,-2) < medbp AND
ref(medp,-4) <= ref(avgp,-3) AND
ref(medbp <= avgp, -1)));
Ref(exitSignal, -1)
Order Type: Stop Limit Limit or Stop Price: Open Edited by user Monday, July 31, 2017 5:19:48 PM(UTC)
| Reason: Not specified
|