Swing Points Long Trading System
Forums › ProRealTime forum Italiano › Supporto ProOrder › Swing Points Long Trading System
- This topic has 7 replies, 2 voices, and was last updated 8 years ago by Nicolas.
-
-
09/06/2016 at 1:20 PM #12713
Swing Points Long Trading System basato sugli Swing Point di Larry William, usa delle barre daily per identificare particolari patterns che con buona probabilità diano vita a un rally rialzista.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354DEFPARAM CumulateOrders = False// ---------------------------------------------------------------------// Swing points long// ---------------------------------------------------------------------// --- calcola LottiOnce Lotti = 1// ---------------------------------------------------------------------// Swing points long type 1c1 = (close>close[1] and close[1]<close[2])c2 = (close[2]>close[3] and close[3]<close[4])c3 = (close>close[2] and close[1]>close[3])EntryLongType1 = c1 AND c2 AND c3// Swing points long type 2c4=(close>close[1] and close[1]<close[2])c5=(close[2]>close[3] and close[3]<close[4])c6=(close>close[2] and close[1]<close[3])EntryLongType2 = c4 AND c5 AND c6// ---------------------------------------------------------------------// --- StrategiaLong = EntryLongType1 OR EntryLongType2// ---------------------------------------------------------------------// Condizioni per entrare su posizioni longIF NOT LongOnMarket AND Long THENBUY Lotti CONTRACTS AT MARKET NEXTBAROPENENDIF// ---------------------------------------------------------------------// Stop e target://trailing stop functiontrailingstart = 20 //trailing stop inizialetrailingstep = 5 //passo per spostare lo "stoploss"//reset StopLossIF NOT ONMARKET THENnewSL=0ENDIF//gestione posizione LongIF LONGONMARKET THENIF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THENnewSL = tradeprice(1)+trailingstep*pipsizeENDIFIF newSL>0 AND close-newSL>=trailingstep*pipsize THENnewSL = newSL+trailingstep*pipsizeENDIFENDIFIF newSL>0 THENSELL AT newSL STOPENDIF// ---------------------------------------------------------------------09/06/2016 at 1:25 PM #12717Ciao Stefano,
Grazie per il vostro contributo. Vedo che avete un grande prelievo sulla strategia, perché i vostri commerci non hanno alcuna stoploss (tra il 2002 e il 2004, 2009/2010). Forse si potrebbe fare un tentativo per rendere meno stressante? 🙂09/06/2016 at 3:21 PM #12719Ciao Nicolas,
in effetti mancava la gestione dello stop loss, quindi , ho rivisto il codice e ti inoltro quello nuovo.
Che ne pensi ?
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970DEFPARAM CumulateOrders = False// ---------------------------------------------------------------------// Swing points long// ---------------------------------------------------------------------// --- calcola LottiOnce Lotti = 1// ---------------------------------------------------------------------// Swing points long type 1c1 = (close>close[1] and close[1]<close[2])c2 = (close[2]>close[3] and close[3]<close[4])c3 = (close>close[2] and close[1]>close[3])EntryLongType1 = c1 AND c2 AND c3// Swing points long type 2c4=(close>close[1] and close[1]<close[2])c5=(close[2]>close[3] and close[3]<close[4])c6=(close>close[2] and close[1]<close[3])EntryLongType2 = c4 AND c5 AND c6// ---------------------------------------------------------------------// --- StrategiaLong = EntryLongType1 OR EntryLongType2// ---------------------------------------------------------------------// Condizioni per entrare su posizioni longIF NOT LongOnMarket AND Long THENBUY Lotti CONTRACTS AT MARKET NEXTBAROPENminimo = lowest[4](Low)StopLoss = (High - minimo)ENDIF// ---------------------------------------------------------------------// Stop e target://trailing stoptrailingstop = 20//resetting variables when no trades are on marketif not onmarket thenMAXPRICE = 0MINPRICE = closepriceexit = 0endif//case SHORT orderif shortonmarket thenMINPRICE = MIN(MINPRICE,close) //saving the MFE of the current tradeif tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price levelendifendif//case LONG orderif longonmarket thenMAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current tradeif MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price levelendifendif//exit on trailing stop price levelsif onmarket and priceexit>0 thenEXITSHORT AT priceexit STOPSELL AT priceexit STOPendifSET STOP LOSS StopLoss//Graph StopLoss// ---------------------------------------------------------------------09/06/2016 at 3:31 PM #1272209/06/2016 at 3:48 PM #12726scusa Nicolas ma non ho capito bene cosa intendi quando mi chiedi: “Avete qualche mestiere che durano solo 1 bar?”
09/06/2016 at 4:17 PM #1273109/06/2016 at 9:36 PM #12747se intendi trading system con time frame da 15 min. o 30 min. e simili … sto testandone alcuni.
Li potrei postare dopo aver finito le prove così magari potresti consigliarmi alcuni miglioramenti.
09/07/2016 at 8:00 AM #12758Ho backtested la strategia e non vedo alcuna di entrata e uscita sullo stesso quotidiano candelabro / bar, ben fatto.
Naturalmente 176 trade nel corso degli ultimi 18 anni non è tanto, ma le voci sono corrette e ben identificato. Questa strategia è una buona prova di concetto. -
AuthorPosts
Find exclusive trading pro-tools on