I almost developed my trade strategy in Ninja Strategy Creator.
But I still have 4 problems whih I can not resolve myself. I'm not programmer and I do not know how to resolve folowing problems.
My trading system is based on trend following rules.
I enter long when the bar 0 closing price is above "n" (let's say 10) previous bars closing and opening prices.
I enter short when the bar 0 closing price is below "n" (let's say 10) previous bars closing and opening prices.
1. I build condition 20 conditions for above in Condition and Action builder:
(Close[1] < Close[0]
&& Close[2] < Close[0]
&& Close[3] < Close[0]
&& Close[4] < Close[0]
&& Close[5] < Close[0]
&& Close[6] < Close[0]
&& Close[7] < Close[0]
&& Close[8] < Close[0]
&& Close[9] < Close[0]
&& Close[10] < Close[0]
&& Open[0] < Close[0]
&& Open[1] < Close[0]
&& Open[2] < Close[0]
&& Open[3] < Close[0]
&& Open[4] < Close[0]
&& Open[5] < Close[0]
&& Open[6] < Close[0]
&& Open[7] < Close[0]
&& Open[8] < Close[0]
&& Open[9] < Close[0]
&& Open[10] < Close[0])
{
EnterLong(1, "");
Close[1] > Close[0]
&& Close[2] > Close[0]
&& Close[3] > Close[0]
&& Close[4] > Close[0]
&& Close[5] > Close[0]
&& Close[6] > Close[0]
&& Close[7] > Close[0]
&& Close[8] > Close[0]
&& Close[9] > Close[0]
&& Close[10] > Close[0]
&& Open[0] > Close[0]
&& Open[1] > Close[0]
&& Open[2] > Close[0]
&& Open[3] > Close[0]
&& Open[4] > Close[0]
&& Open[5] > Close[0]
&& Open[6] > Close[0]
&& Open[7] > Close[0]
&& Open[8] > Close[0]
&& Open[9] > Close[0]
&& Open[10] > Close[0])
{
EnterShort(1, "");
It's works but I can not optymize it.
Are there any diffrent way to set such conditions using User Definied Imputs whih allow to optymize the "n" numbers of previous bars ????
2.I would like to change trading parameters ( number of bar before, stop loss and stop limit for night time and market openning time.
For example:
From 3:15 PM to 8:00PM strategy do not trade. I would like to strategy ignore all trading signals.
From 8:00 PM to 8:30 AM , trading signals from 10 bars ago, stop loss 20 ticks, stop limit 60 ticks
From 8:30 PM to 3:15 PM tradin signal from 15 bars, stop loss 10 ticks stop limit 100 ticks
Could you advise me how to programme such conditions.
Maybe make 2 separate strategies and set different time for activate them???
I do not know how to do it
3. Now stop loss and stop limit are calculated from the real price of transaction but I would like
to calculate them from the exact trade signal price (in my case bar closing price) no matter real buy/sell price.
4. How to programme strategy to place orders 2 or 3 second before bar close??
Rgds
Czarek
Comment