I' running a strategy for many years on metastock (to IB TWS) without any problem but I'm switching to MC now. I'm trying to convert the formula correctly to test MC.
The last sessions, the signals looked almost 100% similar until today. MC is going short altough in Metastock it's still long and MS has it correct.
There should only be a short AFTER the long has an exitsignal. Not switching directly from long to short as soon the shortcondition is met.
And vice versa, only long after a shortexit.
(When LX, it's possible to have a SX on the bar)
Is there a solution for this?
For example, putting all the conditions (LE,LX, SE, SX) into one file?
Short signal in MC when still long in MS [SOLVED]
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Short signal in MC when still long in MS
EasyLanguage can be programmed to execute your logic, but you have to specific as to your intent.I' running a strategy for many years on metastock (to IB TWS) without any problem but I'm switching to MC now. I'm trying to convert the formula correctly to test MC.
The last sessions, the signals looked almost 100% similar until today. MC is going short altough in Metastock it's still long and MS has it correct.
There should only be a short AFTER the long has an exitsignal. Not switching directly from long to short as soon the shortcondition is met.
And vice versa, only long after a shortexit.
(When LX, it's possible to have a SX on the bar)
Is there a solution for this?
For example, putting all the conditions (LE,LX, SE, SX) into one file?
e.g. If you have a LONG postion, you can have the following options:
using the keyword SELL will liquidate your LONG position. ie. go flat.
using the keyword SELLSHORT will liquidate your LONG position, and at the same time enter you into a SHORT position.
Using the proper keyword will ensure the execution of your orders as intended.
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Short signal in MC when still long in MS
You can put all the conditions in one file.::
Is there a solution for this?
For example, putting all the conditions (LE,LX, SE, SX) into one file?
Most of the programmers would prefer to have all the logics in one file.
Re: Short signal in MC when still long in MS
You can put all the conditions in one file.::
Is there a solution for this?
For example, putting all the conditions (LE,LX, SE, SX) into one file?
Most of the programmers would prefer to have all the logics in one file.
----
It's in 4 files now (LE,LX,SE,SX) but I use the commands Buy, Sell, Sell Short and BuyToCover so that should not give a problem isn't?
Hereunder my testing system:
------
LONG
------
Inputs: Displace( 0 ),
Price( Close);
variables: var1( 0 );
var1 = WAverage( Price, 30);
if Displace <= 0 then
begin
condition1 = Close > var1 ;
if condition1 then
Buy ( "DBLong" ) next bar at market ;
end ;
----------
LONGEXIT
-----------
Inputs: Displace( 0 );
variables: var1( 0 );
var1 = Lowest( Low, 10 )[1];
if Displace <= 0 then
begin
condition1 = Close < var1
;
if condition1 then
Sell ( "DBExitL" ) next bar at market ;
end ;
-------
SHORT
-------
Inputs: Displace( 0 ),
Price( Close);
variables: var1( 0 );
var1 = WAverage( Price, 20 );
if Displace <= 0 then
begin
condition1 = Close < var1;
if condition1 then
Sell Short ( "DBShort" ) next bar at market ;
end;
------
Altough, the SELL condition was not met, the SELL SHORT condition was met and the system goes SHORT.
How can I explain that the SELL SHORT can only be done, after a SELL (exit long) condition?
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: Short signal in MC when still long in MS [SOLVED]
Hello Dirk8,
The solutions for for you would be to combine all 4 scripts into 1 and creating a sequence of conditions checking in order to avoid entering/reversing into short before exiting long. Please take into account the EL order execution priority.
If conditions for exiting long (sell) are not satisfied, but the conditions for entering short (seelshort) are satisfied, 1 order to reverse position (if you are long now) into short will be generated and sent.Altough, the SELL condition was not met, the SELL SHORT condition was met and the system goes SHORT.
How can I explain that the SELL SHORT can only be done, after a SELL (exit long) condition?
The solutions for for you would be to combine all 4 scripts into 1 and creating a sequence of conditions checking in order to avoid entering/reversing into short before exiting long. Please take into account the EL order execution priority.