Hello,
Could a kind soul help me to write the below code so that MC could compile this reversal signal:
If DMIMinus crosses_above DMIPlus Then Sell This Bar on Close;
If DMIPlus crosses_below DMIMinus Then Buy This Bar on Close;
The idea that I have in my mind is shown in the attachement.
Many thanks in advance
Regards
DMI signal little help in coding needed
-
- Posts: 323
- Joined: 07 Jan 2007
- Location: Lahore, Pakistan
- Has thanked: 64 times
- Been thanked: 57 times
DMI Cross
ANOTHER FAILURE!!
NEVER MIND. HERE IS THE CODE:
JUST
1. CREATE A NEW SIGNAL
2. PASTE THE CODE
3. AND COMPILE
NEVER MIND. HERE IS THE CODE:
Code: Select all
Inputs: DMIPlusLength( 14 ), DMIMinusLength( 14 ) ;
Variables: var0( 0 ), var1( 0 ) ;
var0 = DMIPlus( DMIPlusLength ) ;
var1 = DMIMinus( DMIMinusLength ) ;
Condition1 = CurrentBar > 1 and var0 crosses under var1 ;
Condition2 = CurrentBar > 1 and var1 crosses under var0 ;
If Condition1 then
Sell Short ( "DMIsell" ) next bar at market ;
If Condition2 then
Buy ( "DMIbuy" ) next bar at market ;
1. CREATE A NEW SIGNAL
2. PASTE THE CODE
3. AND COMPILE