StockFetcher Forums · Filter Exchange · Kevin_in_GA -- would you repost a script? | << 1 2 3 4 >>Post Follow-up |
Kevin_in_GA 4,599 posts msg #102188 - Ignore Kevin_in_GA |
8/11/2011 3:02:35 PM If you are using weekly data, the start and end dates are predefined. This is the most easily accessed data (from Yahoo or other sources) and so backtesting on a day of week - e.g., each Tuesday - is not really practicable or easily done. Another approach that I have looked at is to take the MA(5) as the data set, and look back 65 days (13 weeks, plus one week from the MA). This way you are using daily data and smoothing it out using the 5-day moving average. This is not optimized per se, but uses the same basic 14 week look back period that has shown consistently good performance. |
jackmack 334 posts msg #102190 - Ignore jackmack |
8/11/2011 4:45:47 PM Thank you - that sure answered the day question - spot on. One more please - would it be prudent to use stops at all since you are all in on 1 ETF? Thank you |
Kevin_in_GA 4,599 posts msg #102191 - Ignore Kevin_in_GA |
8/11/2011 6:19:46 PM No stops - this is designed without stops, and is based on the work of Mebane Faber. Think of 401ks, were you do not have stops. |
saico 59 posts msg #102551 - Ignore saico |
9/6/2011 8:54:33 AM Hi Kevin, I found a very promising script for WL with a solid track record. Do you think its possible to have this written as a SF script? Unfortunately I'm not that good in coding, but I think its worth the work. Regards saico Here's the script. var LOW1, BUYLIMITPRICE: float; var LOW, WAGER, BAR, BAND: integer; InstallProfitTarget (5); Low := CreateSeries(); wager := 5000; for Bar := 3 to BarCount() - 1 do begin Low1 := (PriceLow (bar) * 0.87); SetSeriesValue(Bar, Low, Low1); end; Band := offsetSeries(low, -1); PlotSeries( Band, 0, #red, 0 ); for Bar := 3 to BarCount() - 1 do begin if LastPositionActive() then begin { Exit Trade } ApplyAutoStops (bar); If Bar + 1 - PositionEntryBar( LastPosition() ) > 2 then SellAtMarket ( Bar + 1, LastPosition(), 'TIME Exit' ); end else begin {Enter Trade} BuyLimitPrice := ( GetSeriesValue(Bar, Low)); if ((PriceClose( Bar-1 ) < PriceOpen( Bar-1 )) and (PriceClose( Bar ) < PriceOpen( Bar )) and (PriceClose( Bar ) < PriceClose( Bar-1 )) and (PriceOpen( Bar ) < PriceClose( Bar-1 ))) then BuyAtLimit( Bar + 1, BuyLimitPrice, ''); end; end; |
Kevin_in_GA 4,599 posts msg #102552 - Ignore Kevin_in_GA |
9/6/2011 10:07:03 AM saico: I honestly have no idea what this even means. Not sure that it relates to this particular thread either. Can you provide more detail on what it does and perhaps the historical performance that makes it worthwhile? This might be best explored in a new thread. |
straken 469 posts msg #102553 - Ignore straken |
9/6/2011 9:37:17 PM Smells like MT script except it isn't. Saico, Stockfetcher is EOD data it does not read daily bars and intraday time frames. If your looking for the TS or MT4 scripts for trailing stops you can modify some of mine for your needs. // Trailing SELL if(OrderStopLoss()-Ask>LockProfit*Point) { OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Loc kProfit*Point,OrderTakeProfit(),0); ///__REMOVED__/-Ask," ",LockProfit*Point," ",Ask+LockProfit*Point); } Text[3]="Trailing SL at trade no: #"+OrderTicket(); ObjectSet("ObjLabel4", OBJPROP_CORNER, 1); ObjectSet("ObjLabel4", OBJPROP_XDISTANCE, 10); ObjectSet("ObjLabel4", OBJPROP_YDISTANCE, 45); ObjectSetText("ObjLabel4", Text[3], 7, "Arial",Yellow); } else if (Digits==3 || Digits==5) // for broker 5 Digits { for(iTrade=0; iTrade OrderSelect(iTrade, SELECT_BY_POS, MODE_TRADES); if(OrderSymbol()!=Symbol()) continue; if(OrderType()==0) { // Coding for BUY condition if (OrderStopLoss()==0 && OrderTakeProfit()==0) { // If SL && TP ==0, Then Setup SL && TP now if(OrderModify(OrderTicket(),OrderOpenPrice(),Bid-StopLoss*Point*10,Ask+TakeProfit*Point*10,0)==true ) { Text[3]="Put SL and TP at trade BUY no: #"+OrderTicket(); } else { Text[3]="ERROR -- Put SL and TP at trade BUY no: #"+OrderTicket(); } ObjectSet("ObjLabel4", OBJPROP_CORNER, 1); ObjectSet("ObjLabel4", OBJPROP_XDISTANCE, 10); ObjectSet("ObjLabel4", OBJPROP_YDISTANCE, 45); ObjectSetText("ObjLabel4", Text[3], 7, "Arial",Yellow); } else { // Check if profit ? Is it possible to move the Stop Loss ? if (Bid-OrderOpenPrice()>LockProfit*Point*10) { // Yes, move the SL. Lock the profit +1 if(OrderStopLoss()<=OrderOpenPrice()) { if(OrderModify(OrderTicket(),OrderOpenPrice(),Orde rOpenPrice()+1*Point*10,OrderTakeProfit(),0)==true ) { Text[3]="Modify SL at trade BUY no: #"+OrderTicket(); } else { Text[3]="ERROR -- Modifying SL at trade BUY no: #"+OrderTicket(); } ObjectSet("ObjLabel4", OBJPROP_CORNER, 1); ObjectSet("ObjLabel4", OBJPROP_XDISTANCE, 10); ObjectSet("ObjLabel4", OBJPROP_YDISTANCE, 45); ObjectSetText("ObjLabel4", Text[3], 7, "Arial",Yellow); } else { // Trailing BUY if(Bid-OrderStopLoss()>LockProfit*Point*10) { OrderModify(OrderTicket(),OrderOpenPrice(),Bid-LockProfit*Point*10,OrderTakeProfit(),0); ///__REMOVED__/," ",LockProfit*Point," ",Bid-LockProfit*Point); } Text[3]="Trailing SL trade no: #"+OrderTicket(); ObjectSet("ObjLabel4", OBJPROP_CORNER, 1); ObjectSet("ObjLabel4", OBJPROP_XDISTANCE, 10); ObjectSet("ObjLabel4", OBJPROP_YDISTANCE, 45); ObjectSetText("ObjLabel4", Text[3], 7, "Arial",Yellow); } else { // Coding for SELL condition if (OrderStopLoss()==0 && OrderTakeProfit()==0) { // If SL && TP ==0, Then Setup SL && TP now if(OrderModify(OrderTicket(),OrderOpenPrice(),Ask+ StopLoss*Point*10,Bid-TakeProfit*Point*10,0)==true) { Text[3]="Put SL and TP at trade SELL no: #"+OrderTicket(); } else { Text[3]="ERROR -- Put SL and TP at trade SELL no: #"+OrderTicket(); } ObjectSet("ObjLabel4", OBJPROP_CORNER, 1); ObjectSet("ObjLabel4", OBJPROP_XDISTANCE, 10); ObjectSet("ObjLabel4", OBJPROP_YDISTANCE, 45); ObjectSetText("ObjLabel4", Text[3], 7, "Arial",Yellow); } else { if (OrderOpenPrice()-Ask>LockProfit*Point*10) { // Yes, move the SL. Lock the profit +1 if(OrderStopLoss()>=OrderOpenPrice()) { if(OrderModify(OrderTicket(),OrderOpenPrice(),Orde rOpenPrice()-1*Point*10,OrderTakeProfit(),0)==true) { Text[3]="Modify SL at trade SELL no: #"+OrderTicket(); } else { Text[3]="ERROR -- Modifying SL at trade SELL no: #"+OrderTicket(); } ObjectSet("ObjLabel4", OBJPROP_CORNER, 1); ObjectSet("ObjLabel4", OBJPROP_XDISTANCE, 10); ObjectSet("ObjLabel4", OBJPROP_YDISTANCE, 45); ObjectSetText("ObjLabel4", Text[3], 7, "Arial",Yellow); } else { // Trailing SELL if(OrderStopLoss()-Ask>LockProfit*Point*10) { OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Loc kProfit*Point*10,OrderTakeProfit(),0); ///__REMOVED__/-Ask," ",LockProfit*Point," ",Ask+LockProfit*Point); } Text[3]="Trailing SL at trade no: #"+OrderTicket(); ObjectSet("ObjLabel4", OBJPROP_CORNER, 1); ObjectSet("ObjLabel4", OBJPROP_XDISTANCE, 10); ObjectSet("ObjLabel4", OBJPROP_YDISTANCE, 45); ObjectSetText("ObjLabel4", Text[3], 7, "Arial",Yellow); return(0); //Straken Rev H=Stockfinder |
StockFetcher Forums · Filter Exchange · Kevin_in_GA -- would you repost a script? | << 1 2 3 4 >>Post Follow-up |
Copyright 2022 - Vestyl Software L.L.C.•Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data
Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus