Henry,
Do you have the time filter code for easylanguage ?
I saw the time filtercode you posted in .net fm and wondered if you can do same thing in powerlanguage ?
thanks
shane
Time filter
-
- Posts: 196
- Joined: 08 Aug 2012
- Has thanked: 41 times
- Been thanked: 41 times
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Time filter
From reading your other topic I guess you're looking for something like this:
Code: Select all
// Only trade during the main session
if (Time > 900) and (Time < 1530) then begin
// Perform the calculations,
// order submitting here
end;
-
- Posts: 196
- Joined: 08 Aug 2012
- Has thanked: 41 times
- Been thanked: 41 times
Re: Time filter
Hi
Is it really that simple ?
I am new to easylanguage. I like the simplicity of it.
Do you know how you can flatten everything at 15:30 in relation to your code ?
thank you for your help,
shane
Is it really that simple ?
I am new to easylanguage. I like the simplicity of it.
Do you know how you can flatten everything at 15:30 in relation to your code ?
thank you for your help,
shane
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Time filter
It is indeed simple compared to MultiCharts .NET or other, more elaborative programming languages. But being simple doesn't make it easy by definition. :]Do you know how you can flatten everything at 15:30 in relation to your code?
To close all positions after the session:
Code: Select all
// As soon as it is later than 15:30:00..
if (Time_s > 153000) then begin
// Close all long contracts
if (MarketPosition(0) > 0) then
Sell ("XL") all contracts next bar at market
// Close all short contracts
else if (MarketPosition(0) < 0) then
BuyToCover ("XS") all contracts next bar at market;
end;
-
- Posts: 196
- Joined: 08 Aug 2012
- Has thanked: 41 times
- Been thanked: 41 times
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Time filter
When liquidating, you do not need to check for MarketPosition. The flattening order will only be sent if you have a position.
You can simplify the code as follows:
This is assuming you are autotrading in sync, and you do not have any additional manual orders or orders from other strategies.
You can simplify the code as follows:
Code: Select all
// As soon as it is later than 15:30:00..
if (Time_s >= 153000) then
begin
Sell ("XL") all contracts next bar at market;
BuyToCover ("XS") all contracts next bar at market;
end;