- Joined
- 23 June 2006
- Posts
- 3
- Reactions
- 0
There are 2 main reasons for creating an Automated system.
1) To test your theory.
2) To remove the psychology from your decision making process.
Here is some code written in Easy Language used on the Trade Station platform. This sholud give you an idea of how to create a simple system.
------------------
(setup)
Open a chart and set the time scale to 3 mins, Then click on “Insert” then “Symbol” and enter the same symbol again and set the time frame to 15 min. This second symbol will now be Data2.
Set you inputs to suit, here we can see I have set the Profit Target to $2000 which means 200 pips on a FX chart. The Stop and Break Even Stop is set to $400.
The code will now look for MA crossovers on a 3min chart when the 15 min chart is same. So it will only enter long trades when the fast avg on the 15 min chart is above the slow avg on the 15 min chart and visa versa.
--------------------------------------
(The code)
{By John Watters//Hurricane-fx//2006}
inputs: Price( Close ), FastLength( 7 ), SlowLength( 50 ),
ProfitTargetAmt( 2000 ), StopLossAmt(400),
BreakevenFloorAmt( 400 );{Declaring Input Values}
variables: FastAvg( 0 ), SlowAvg( 0 ),FastAvg15( 0, data2 ),
SlowAvg15( 0,data2 );{Declaring the Variables}
{Defining the Variables}
FastAvg = xAverage(Price, FastLength);
SlowAvg = xAverage(Price, SlowLength);
FastAvg15 = xAverage(Price, FastLength)data2;
SlowAvg15 = xAverage(Price, SlowLength)data2;
{Creating the Conditions}
Condition1= FastAvg15 > SlowAvg15;
Condition2= FastAvg15 < SlowAvg15;
Condition3= FastAvg crosses above SlowAvg;
Condition4= FastAvg crosses below SlowAvg;
If CurrentBar > 1 and
{used to avoid spurious cross confirmation}
Marketposition <1 and {Confirms we are not already in a Long Position}
Condition1 and Condition3 then
Buy ( "BUY" ) next bar at market ;
If CurrentBar > 1 and
{used to avoid spurious cross confirmation}
Marketposition >-1 and {Confirms we are not already in a Short Position}
Condition2 and Condition4 then
Sellshort ( "SS" ) next bar at market ;
{DETERMINE TRADE EXIT}
If Marketposition <> 0 {Says If we are in a position then}
then BEGIN
SetProfitTarget( ProfitTargetAmt ) ;
SetStopLoss( StopLossAmt );
SetBreakeven( BreakevenFloorAmt );
end;
---------------------------
Mr Hurricane
1) To test your theory.
2) To remove the psychology from your decision making process.
Here is some code written in Easy Language used on the Trade Station platform. This sholud give you an idea of how to create a simple system.
------------------
(setup)
Open a chart and set the time scale to 3 mins, Then click on “Insert” then “Symbol” and enter the same symbol again and set the time frame to 15 min. This second symbol will now be Data2.
Set you inputs to suit, here we can see I have set the Profit Target to $2000 which means 200 pips on a FX chart. The Stop and Break Even Stop is set to $400.
The code will now look for MA crossovers on a 3min chart when the 15 min chart is same. So it will only enter long trades when the fast avg on the 15 min chart is above the slow avg on the 15 min chart and visa versa.
--------------------------------------
(The code)
{By John Watters//Hurricane-fx//2006}
inputs: Price( Close ), FastLength( 7 ), SlowLength( 50 ),
ProfitTargetAmt( 2000 ), StopLossAmt(400),
BreakevenFloorAmt( 400 );{Declaring Input Values}
variables: FastAvg( 0 ), SlowAvg( 0 ),FastAvg15( 0, data2 ),
SlowAvg15( 0,data2 );{Declaring the Variables}
{Defining the Variables}
FastAvg = xAverage(Price, FastLength);
SlowAvg = xAverage(Price, SlowLength);
FastAvg15 = xAverage(Price, FastLength)data2;
SlowAvg15 = xAverage(Price, SlowLength)data2;
{Creating the Conditions}
Condition1= FastAvg15 > SlowAvg15;
Condition2= FastAvg15 < SlowAvg15;
Condition3= FastAvg crosses above SlowAvg;
Condition4= FastAvg crosses below SlowAvg;
If CurrentBar > 1 and
{used to avoid spurious cross confirmation}
Marketposition <1 and {Confirms we are not already in a Long Position}
Condition1 and Condition3 then
Buy ( "BUY" ) next bar at market ;
If CurrentBar > 1 and
{used to avoid spurious cross confirmation}
Marketposition >-1 and {Confirms we are not already in a Short Position}
Condition2 and Condition4 then
Sellshort ( "SS" ) next bar at market ;
{DETERMINE TRADE EXIT}
If Marketposition <> 0 {Says If we are in a position then}
then BEGIN
SetProfitTarget( ProfitTargetAmt ) ;
SetStopLoss( StopLossAmt );
SetBreakeven( BreakevenFloorAmt );
end;
---------------------------
Mr Hurricane