| Coding Forum Collaborate, receive help, or discuss coding related issues. |
![]() | | Tweet | |
| | #1 | ||
![]() | EL Strategy Help Needed Enter market short when price closes +40 pts above yesterdays close and time is 2am or later. Exit when either price retraces to yesterday's close, or the time is 9:45am. Reverse for long entry with price -40 pts. I believe it should be quite simple to code, but can't seem to get it. Below is what I came up with. Any assistance would be greatly appreciated. Thanks. inputs: Offset(40), Stop_Loss(500), Exit_Time(945), Start_Time(200); Value1 = CloseD(1); if time >= Start_Time and time <= Exit_Time then begin if marketposition = 0 and close > Value1 + Offset points then sell short next bar at market; if marketposition = 0 and close < Value1 - Offset points then buy next bar at market; end; If time >= Exit_Time and MarketPosition <> 0 then begin Sell all contracts next bar at market; BuyToCover all contracts next bar at market; end; if marketposition = 1 and close <= Value1 then sell all contracts next bar at market; if marketposition = -1 and close >= Value1 then buy to cover all contracts next bar at market; setstoploss(Stop_Loss); | ||
| |
|
| | #2 | ||
![]() | Re: EL Strategy Help Needed
__________________ Only an idiot would reply to a stupid post | ||
| |
|
| | #3 | ||
![]() | Re: EL Strategy Help Needed Code: inputs: Offset(40){amount of ticks not full points}, Stop_Loss(500), Exit_Time(945), Start_Time(200);
if time >= Start_Time and time <= Exit_Time and EntriesToday(Date) = 0 then
Begin
SellShort next bar CloseD(1) +( Offset * ( MinMove / PriceScale )) Limit;
Buy next bar CloseD(1) - ( Offset * ( MinMove / PriceScale )) Limit;
End;
If time >= Exit_Time then
begin
Sell this Bar on Close;
BuyToCover this Bar on Close;
end;
BuyToCover next bar CloseD(1) Limit;
Sell next bar CloseD(1) Limit;
SetStopLoss(Stop_Loss); for a e-mini the reserve word "points" refers to the pricescale / 100, while using MinMove/PriceScale gives you the minimum price fluctation (ticks), for the YM this shouldnt matter as a tick is equal to a full point. i allways try to use limit and stop orders where possible, you will not get good and realistic fills using marketorders, not in real trading due to slippage nor in your backtest; especially not in a less liqued market like the ym. be aware a script like this will give zero sensetivity to changes in volatility as your entry and exit are all a fixed amount of points. Last edited by flyingdutchmen; 09-30-2009 at 11:03 PM. | ||
| |
|
| The Following User Says Thank You to flyingdutchmen For This Useful Post: | ||
Marc33139 (10-01-2009) | ||
![]() |
| Thread Tools | |
| Display Modes | Help Others By Rating This Thread |
| |
| ∧ Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help Needed for Indicator | DutchAngel | Coding Forum | 4 | 04-16-2009 05:22 AM |
| Indicators needed ( help) | stocktrader.in | Coding Forum | 4 | 11-18-2008 01:44 PM |
| Excel Help Needed | brownsfan019 | Trading Indicators | 5 | 06-02-2008 07:24 PM |
| just what i needed | xztheericzx | Beginners Forum | 0 | 11-04-2007 05:21 AM |
| Help Needed DAT Files | Don4 | General Discussion | 1 | 03-26-2007 08:59 PM |