It looks simple but something doesn't work for me while trying to execute orders in chart1 (data1) based on chart2 (data2) trigger condition...
the trigger/condition is 3MA cross on chart2, if condition met sellshort chart1. NOTHING HAPPENS, the condition doest met...
while the reference indicator show the condition met more then 10 times...
the code as follows:
Code: Select all
inputs: FastLength( 4 ), MedLength( 9 ), SlowLength( 18 ) ;
variables: price(Close), price2(close,data2), MyFast( 0,data2 ), MyMed( 0,data2 ), MySlow( 0,data2 );
MyFast = AverageFC( close, FastLength )data2 ;
MyMed = AverageFC( close, MedLength )data2 ;
MySlow = AverageFC( close, SlowLength )data2 ;
Condition1 = price2 > myfast and myfast > MyMed and MyMed > MySlow ;
condition2 = CurrentBar > 1 and Condition1 and Condition1[1] = false;
if condition2 then
sellshort ("short") next bar at market;