Dictionary <String, String> IStrategy.select(DataStoreHelper dsh, SelectMode selectMode, ref String sigInfo) { float zf = dsh.Ref(Info.ZF); bool bIsTwoDownMode = false; Dictionary <String, String> ret; if (zf < -0.04 && zf > -0.095) { ret = selectFor(dsh, selectMode, ref sigInfo, 1, out bIsTwoDownMode); if (bIsTwoDownMode) { var retDict = new Dictionary <String, String>(); retDict[String.Format("TwoDownMode/1")] = ""; return(retDict); } } ret = selectFor(dsh, selectMode, ref sigInfo, 0, out bIsTwoDownMode); if (ret == null) { return(null); } var szZF = dsh.SZRef(Info.ZF); if (szZF > 0 && szZF < 0.011 && dsh.SZAcc(Info.ZF, 7, 1) > 0.03) { return(null); } if (!selectBySZ(dsh)) { return(null); } ret[String.Format("TwoDownMode/0")] = ""; return(ret); }
public bool selectBySZ(DataStoreHelper dsh) { { var szzf = dsh.SZRef(Info.ZF); if (dsh.SZRef(Info.ZF, dsh.SZLL(Info.ZF, 3)) < -0.03 && szzf < 0.005 && szzf > -0.005 && dsh.SZUpShadow() > 0.005 && dsh.SZDownShadow() < -0.005) { return(false); } } float minSZZF = float.MaxValue; float maxSZZF = float.MinValue; int iSigIndex = -1; for (int i = 1; i <= 3; ++i) { var szzf = dsh.SZRef(Info.ZF, i); if (minSZZF > szzf) { minSZZF = szzf; if (minSZZF < -0.02) { iSigIndex = i; break; } } maxSZZF = Math.Max(maxSZZF, szzf); } if (iSigIndex != -1 && maxSZZF < 0.01) { var acc = dsh.SZAcc(Info.ZF, 3, iSigIndex + 1); if (acc > 0.02) { return(false); } } if (dsh.SZAcc(Info.ZF, 6, 1) < -0.06 && dsh.SZRedCount(6, 1) < 3) { return(false); } return(true); }
Dictionary <String, String> IStrategy.select(DataStoreHelper dsh, SelectMode selectMode, ref String sigInfo) { var zf = dsh.Ref(Info.ZF); if (zf > 0 || zf < -0.06) { return(null); } if (!dsh.IsReal()) { return(null); } if (dsh.Ref(Info.OF, 1) < -0.03) { return(null); } int iSigDateIndex = -1; int nUpCount = 0; int nUStopCount = 0; int nDStopCount = 0; bool bMeetTradeSigAllready = false; bool bMeetRealUp = false; float sigDateVol = 0; float otherMaxVol = 0; bool bHasUpShadowTooHight = false; bool bHasDownShadowTooLow = false; float otherMaxZF = 0; float otherMaxC = 0; float otherMaxH = 0; float sumOfSigDateZF = 0; float totalUp = 0; float totalDown = 0; for (int i = 1; i < 8; ++i) { var curOf = dsh.Ref(Info.OF, i); var curHf = dsh.Ref(Info.HF, i); var curZf = dsh.Ref(Info.ZF, i); var curPreZf = dsh.Ref(Info.ZF, i + 1); var vol = dsh.Ref(Info.V, i); if (curOf < 0.03 && curZf > 0.03 && curZf < 0.095 && dsh.Ref(Info.OF, i + 1) < 0.03 && dsh.Ref(Info.ZF, i + 1) > 0.03) { for (int j = i + 2; j < i + 5; j++) { if (dsh.Ref(Info.ZF, j) < 0) { break; } if (dsh.Ref(Info.ZF, j) > 0.05) { return(null); } } if (dsh.AccZF(8, i + 2) < -0.15) { return(null); } float preVol = dsh.Ref(Info.V, i + 1); float chkVol = Math.Max(vol, preVol); for (int j = i + 2; j < i + 6; ++j) { if (dsh.Ref(Info.V, j) > chkVol * 2) { return(null); } } sumOfSigDateZF = curZf + dsh.Ref(Info.ZF, i + 1); if (sumOfSigDateZF > 0.1) { iSigDateIndex = i; sigDateVol = Math.Max(dsh.Ref(Info.V, i + 1), vol); break; } } otherMaxVol = Math.Max(vol, otherMaxVol); if (curZf > 0 && dsh.IsReal(i)) { nUpCount++; } if (curZf > 0.095) { nUStopCount++; } else if (curZf < -0.095) { nDStopCount++; } if (curZf < -0.03) { bMeetTradeSigAllready = true; } else if (curZf > 0.012) { bMeetRealUp = true; } if (curZf > 0) { totalUp += curZf; } else { totalDown += curZf; } if (dsh.UpShadow(i) > 0.03) { bHasUpShadowTooHight = true; } if (dsh.DownShadow(i) < -0.03) { bHasDownShadowTooLow = true; } otherMaxZF = Math.Max(otherMaxZF, curZf); otherMaxC = Math.Max(dsh.Ref(Info.C, i), otherMaxC); otherMaxH = Math.Max(dsh.Ref(Info.H, i), otherMaxH); } if (iSigDateIndex == -1) { return(null); } // sigInfo = dsh.Date(iSigDateIndex).ToString(); if (dsh.Ref(Info.C) < dsh.Ref(Info.L, iSigDateIndex)) { return(null); } if (dsh.Ref(Info.ZF) + Math.Min(dsh.Ref(Info.ZF, iSigDateIndex), dsh.Ref(Info.ZF, iSigDateIndex + 1)) < -0.01) { return(null); } if (totalDown + totalUp < -0.01) { return(null); } if (nUpCount < 2) { return(null); } if (/*nUStopCount > 0 ||*//* nDStopCount > 0 || */ bMeetTradeSigAllready || !bMeetRealUp) { return(null); } float maxUpF = (otherMaxC - dsh.Ref(Info.C, iSigDateIndex)) / dsh.Ref(Info.C, iSigDateIndex); if (maxUpF < 0.015 /* || maxUpF > 0.04*/) { return(null); } if (sigDateVol < otherMaxVol * 1.2) { return(null); } if (sigDateVol > otherMaxVol * 2) { return(null); } if (otherMaxZF + zf > 0) { return(null); } sigInfo = (otherMaxZF + zf).ToString("F4"); if (dsh.Ref(Info.LF) < -0.06) { return(null); } if (bHasUpShadowTooHight || bHasDownShadowTooLow) { return(null); } // if (dsh.Ref(Info.OF) < -0.02) // { // return null; // } if ( dsh.Ref(Info.ZF, 2) < 0.005 && dsh.Ref(Info.ZF, 3) < 0.005) { return(null); } // if (dsh.Ref(Info.ZF, iSigDateIndex-1) < 0 && // dsh.Ref(Info.ZF, iSigDateIndex - 2) < 0) // { // return null; // } if (dsh.Ref(Info.C, iSigDateIndex) < dsh.Ref(Info.O, iSigDateIndex)) { return(null); } if (dsh.Ref(Info.C, iSigDateIndex + 1) < dsh.Ref(Info.O, iSigDateIndex + 1)) { return(null); } var delta = (dsh.Ref(Info.C) - dsh.Ref(Info.O, 1)) / dsh.Ref(Info.C, 1); if (delta > -0.01) { return(null); } var szZF = dsh.SZRef(Info.ZF); if (szZF > 0 && szZF < 0.011 && dsh.SZAcc(Info.ZF, 7, 1) > 0.03) { return(null); } if (!selectBySZ(dsh)) { return(null); } var ret = new Dictionary <String, String>(); ret[String.Format("delta/{0}", delta < -0.02 ? "1" : "0")] = ""; ret[String.Format("maxUp/{0}", maxUpF > 0.02 ? "1" : "0")] = ""; ret[String.Format("maxZF/{0}", otherMaxZF + zf > -0.01 ? "1" : "0")] = ""; ret[String.Format("prezf/{0}", dsh.Ref(Info.ZF, 1) > 0 ? "1" : "0")] = ""; return(ret); }
Dictionary <String, String> IStrategy.select(DataStoreHelper dsh, SelectMode selectMode, ref String sigInfo) { var zf = dsh.Ref(Info.ZF); if (zf > 0.095 || zf < -0.095) { return(null); } if (zf < 0.01) { return(null); } if (dsh.IsLikeSTStop()) { return(null); } if (dsh.DownShadow() < -0.04) { return(null); } if ((dsh.Ref(Info.C, 1) - dsh.Ref(Info.L, 3)) / dsh.Ref(Info.C, 1) > 0) { return(null); } if (dsh.Ref(Info.HL, 1) > dsh.Ref(Info.HL, 2) * 2) { return(null); } if (dsh.Ref(Info.HL, 2) > dsh.Ref(Info.HL, 1) * 2) { return(null); } if (dsh.Ref(Info.C) < dsh.Ref(Info.O, 1)) { return(null); } if ((dsh.Ref(Info.C, 1) - dsh.Ref(Info.O, 5)) / dsh.Ref(Info.C, 1) > 0.01) { return(null); } if (dsh.Ref(Info.L) < dsh.Ref(Info.L, 1) && dsh.Ref(Info.H) > dsh.Ref(Info.H, 1)) { return(null); } if (dsh.AccZF(2, 1) < -0.1) { return(null); } if (dsh.AccZF(3) > 0.02) { return(null); } if (dsh.AccZF(2) < -0.04) { return(null); } var accZF6 = dsh.AccZF(6); if (accZF6 > 0.08) { return(null); } int nDownCount = 2; if (dsh.EveryDown(1) != nDownCount) { return(null); } if (dsh.Ref(Info.ZF, nDownCount + 1) < 0.01) { return(null); } if (dsh.Ref(Info.ZF, dsh.HH(Info.ZF, 6)) < 0.03) { return(null); } if (dsh.Ref(Info.ZF, nDownCount + 2) > -0.01) { return(null); } if (dsh.Ref(Info.ZF, nDownCount + 3) < 0.01) { return(null); } var upV = dsh.Acc(Info.V, 6, 0, 1); var downV = dsh.Acc(Info.V, 6, 0, -1); if (upV > downV * 1.5) { return(null); } for (int i = 0; i <= 5; ++i) { var curOF = dsh.Ref(Info.OF, i); var curZF = dsh.Ref(Info.ZF, i); if (!dsh.IsReal(i)) { return(null); } if (curZF > 0.095 || curZF < -0.095) { return(null); } if (curOF > 0.02 && curZF < 0) { return(null); } if (curOF < -0.02 && curZF < 0) { return(null); } if (dsh.Ref(Info.CO, i) / dsh.Ref(Info.C, i + 1) < 0.006) { return(null); } } var szZF = dsh.SZRef(Info.ZF); if (szZF > 0 && szZF < 0.011 && dsh.SZAcc(Info.ZF, 7, 1) > 0.03) { return(null); } if (!selectBySZ(dsh)) { return(null); } return(EmptyRateItemButSel); }
Dictionary <String, String> IStrategy.select(DataStoreHelper dsh, SelectMode selectMode, ref String sigInfo) { var zf = dsh.Ref(Info.ZF); if (zf > 0.095 || zf < -0.095) { return(null); } if (zf < 0.01) { return(null); } if (dsh.IsLikeSTStop()) { return(null); } var szZF = dsh.SZRef(Info.ZF); if (szZF < 0.01) { return(null); } if (szZF < 0.011 && dsh.SZAcc(Info.ZF, 7, 1) > 0.03) { return(null); } var recentMaxSZZF = dsh.SZRef(Info.ZF, dsh.SZHH(Info.ZF, 10, 1)); if (recentMaxSZZF < 0.005) { return(null); } var minSZZFIndex = dsh.SZLL(Info.ZF, 8, 1); if (dsh.SZRef(Info.ZF, minSZZFIndex) > -0.005) { return(null); } if (!dsh.IsReal()) { return(null); } if (dsh.UpShadow() > 0.04) { return(null); } if (dsh.DownShadow() < -0.04) { return(null); } var of = dsh.Ref(Info.OF); if (of > 0.02 || of < -0.04) { return(null); } if (dsh.Ref(Info.ZF, 1) > -0.02 || dsh.Ref(Info.ZF, 1) < -0.095) { return(null); } if (dsh.Ref(Info.ZF, 2) < -0.02) { return(null); } if (zf + dsh.Ref(Info.ZF, 1) < 0) { return(null); } if (dsh.Ref(Info.V) > dsh.Ref(Info.V, 1) * 1.5) { return(null); } for (int i = 1; i < 8; ++i) { var curZF = dsh.Ref(Info.ZF, i); var curOf = dsh.Ref(Info.OF, i); if (curOf > 0.04 && curZF < 0) { return(null); } if (curOf < -0.02 && curZF < 0) { return(null); } } if (dsh.AccZF(8, 1) < -0.1) { return(null); } if (dsh.Ref(Info.ZF, dsh.HH(Info.CO, 10)) > 0) { return(null); } int iMaxVolIndex = dsh.HH(Info.V, 10); if (dsh.Ref(Info.C, iMaxVolIndex) > dsh.Ref(Info.O, iMaxVolIndex)) { return(null); } if ((dsh.Ref(Info.H, dsh.HH(Info.H, 8)) - dsh.Ref(Info.L, dsh.LL(Info.L, 8))) / dsh.Ref(Info.C, 1) > 0.2) { return(null); } return(EmptyRateItemButSel); }
Dictionary <String, String> IStrategy.select(DataStoreHelper dsh, SelectMode selectMode, ref String sigInfo) { var zf = dsh.Ref(Info.ZF); if (zf > 0.095 || zf < -0.095) { return(null); } if (zf > 0.03 || zf < 0.02) { return(null); } if (!dsh.IsReal()) { return(null); } if (dsh.UpShadow() > 0.04) { return(null); } var of = dsh.Ref(Info.OF); if (of > 0.02 || of < -0.04) { return(null); } if (dsh.Ref(Info.ZF, 1) > -0.005) { return(null); } if (dsh.Ref(Info.ZF, 2) < 0.005 || !dsh.IsReal(2)) { return(null); } if (dsh.Ref(Info.V) > dsh.Ref(Info.V, 1) * 1.5) { return(null); } if ((dsh.Ref(Info.C) - dsh.Ref(Info.C, 2)) / dsh.Ref(Info.C, 1) > 0.01) { return(null); } if (dsh.Ref(Info.C) > dsh.Ref(Info.O, 1)) { return(null); } if ((dsh.Ref(Info.L) - dsh.Ref(Info.L, 2)) / dsh.Ref(Info.C, 1) > 0.01) { return(null); } int nTotalDownDays = dsh.EveryDown(3); if (nTotalDownDays < 4) { return(null); } if (dsh.EveryUp(3 + nTotalDownDays) > nTotalDownDays) { return(null); } float totalZF = dsh.AccZF(nTotalDownDays, 3); if (totalZF > -0.1) { return(null); } var szZF = dsh.SZRef(Info.ZF); if (szZF > 0 && szZF < 0.011 && dsh.SZAcc(Info.ZF, 7, 1) > 0.03) { return(null); } if (!selectBySZ(dsh)) { return(null); } return(EmptyRateItemButSel); }
Dictionary <String, String> IStrategy.select(DataStoreHelper dsh, SelectMode selectMode, ref String sigInfo) { var zf = dsh.Ref(Info.ZF); if (zf > 0.095 || zf < -0.095) { return(null); } if (zf > 0.03 || zf < 0.02) { return(null); } if (!dsh.IsReal()) { return(null); } if (dsh.UpShadow() > 0.04) { return(null); } var of = dsh.Ref(Info.OF); if (of > 0.02 || of < -0.04) { return(null); } if ((dsh.Ref(Info.H) - dsh.Ref(Info.H, 1)) / dsh.Ref(Info.C, 1) < -0.03) { return(null); } int nOccurCount = 0; bool bSearchDown = true; int iMaxSearchIndex = 1; float maxDownVol = float.MinValue; float maxUpVol = float.MinValue; for (int i = 1; i < 100; ++i) { var curZF = dsh.Ref(Info.ZF, i); var curOf = dsh.Ref(Info.OF, i); if (curOf > 0.04 && curZF < 0) { return(null); } if (curOf < -0.02 && curZF < 0) { return(null); } if (curZF < -0.095) { break; } if (!dsh.IsReal(i)) { return(null); } if (bSearchDown && curZF > 0) { break; } if (!bSearchDown && curZF < 0) { break; } if (dsh.Ref(Info.CO, i) / dsh.Ref(Info.C, 1) < 0.01) { break; } if (dsh.IsReal(i) && curZF < -0.01 && dsh.IsReal(i + 1) && dsh.Ref(Info.ZF, i + 1) > 0.01 && dsh.IsReal(i + 2) && dsh.Ref(Info.ZF, i + 2) < -0.01) { ++nOccurCount; iMaxSearchIndex = i; } bSearchDown = !bSearchDown; if (curZF > 0) { maxUpVol = Math.Max(maxUpVol, dsh.Ref(Info.V, i)); } else { maxDownVol = Math.Max(maxDownVol, dsh.Ref(Info.V, i)); } } if (nOccurCount != 2) { return(null); } if (dsh.Ref(Info.V) > Math.Max(maxDownVol, maxUpVol) * 1.5) { return(null); } if (maxUpVol > maxDownVol * 2) { return(null); } var szZF = dsh.SZRef(Info.ZF); if (szZF > 0 && szZF < 0.011 && dsh.SZAcc(Info.ZF, 7, 1) > 0.03) { return(null); } if (!selectBySZ(dsh)) { return(null); } return(EmptyRateItemButSel); }
Dictionary <String, String> IStrategy.select(DataStoreHelper dsh, SelectMode selectMode, ref String sigInfo) { var zf = dsh.Ref(Info.ZF); if (zf > 0 || zf < -0.095) { return(null); } if (!dsh.IsReal()) { return(null); } if (dsh.Ref(Info.OF, 1) < -0.03) { return(null); } if (dsh.Ref(Info.LF) < -0.06) { return(null); } int iSigDateIndex = -1; int nUpCount = 0; int nDownCount = 0; int nUStopCount = 0; int nDStopCount = 0; bool bMeetTradeSigAllready = false; bool bMeetRealUp = false; float sigDateVol = 0; float otherMaxVol = 0; bool bHasUpShadowTooHight = false; bool bHasDownShadowTooLow = false; float otherMaxZF = 0; float otherMinZF = float.MaxValue; float otherMaxC = 0; float otherMaxH = 0; float sumOfSigDateZF = 0; float otherMaxDownV = 0; float minSigV = float.MaxValue; float totalUp = 0; float totalDown = 0; for (int i = 1; i < 8; ++i) { var curOf = dsh.Ref(Info.OF, i); var curHf = dsh.Ref(Info.HF, i); var curZf = dsh.Ref(Info.ZF, i); var curPreZf = dsh.Ref(Info.ZF, i + 1); var vol = dsh.Ref(Info.V, i); var preVol = dsh.Ref(Info.V, i + 1); if (dsh.Ref(Info.OF, i) > 0.03 && curZf < 0) { return(null); } float ma5 = dsh.MA(Info.V, 10, i + 2); float hhv = dsh.Ref(Info.V, dsh.HH(Info.V, 5, i + 2)); if (curZf > 0.01 && curPreZf > 0.01 && vol > 1.3 * hhv && preVol > 1.3 * hhv && (vol < vRate_ * preVol && preVol < vRate_ * vol) && vol / ma5 > vRate_ && preVol / ma5 > vRate_ && dsh.Ref(Info.ZF, i + 2) < 0.05 && dsh.Ref(Info.V, i + 2) / dsh.MA(Info.V, 5, i + 3) < vRate_) { for (int j = i + 2; j < i + 7; j++) { if (dsh.Ref(Info.ZF, j) < -0.095) { return(null); } } if (dsh.AccZF(2, i) < 0.05) { return(null); } { iSigDateIndex = i; sigDateVol = Math.Max(dsh.Ref(Info.V, i + 1), vol); minSigV = Math.Min(dsh.Ref(Info.V, i + 1), vol); break; } } otherMaxVol = Math.Max(vol, otherMaxVol); if (curZf > 0.005 && dsh.IsReal(i)) { nUpCount++; } else if (curZf < -0.005 && dsh.IsReal(i)) { nDownCount++; } if (curZf > 0.095) { nUStopCount++; } else if (curZf < -0.095) { nDStopCount++; } if (curZf < -0.03) { bMeetTradeSigAllready = true; } if (curZf > 0) { totalUp += curZf; } else { totalDown += curZf; } if (curZf > 0.012) { bMeetRealUp = true; } if (dsh.UpShadow(i) > 0.03) { bHasUpShadowTooHight = true; } if (dsh.DownShadow(i) < -0.03) { bHasDownShadowTooLow = true; } otherMaxZF = Math.Max(otherMaxZF, curZf); otherMinZF = Math.Min(otherMinZF, curZf); otherMaxC = Math.Max(dsh.Ref(Info.C, i), otherMaxC); otherMaxH = Math.Max(dsh.Ref(Info.H, i), otherMaxH); if (curZf < 0) { otherMaxDownV = Math.Max(otherMaxDownV, vol); } } if (iSigDateIndex == -1) { return(null); } // sigInfo = dsh.Date(iSigDateIndex).ToString(); if (totalDown + totalUp < -0.01) { return(null); } if (nUpCount < 2) { return(null); } if (/*nUStopCount > 0 ||*//* nDStopCount > 0 || */ bMeetTradeSigAllready || !bMeetRealUp) { return(null); } float maxUpF = (otherMaxC - dsh.Ref(Info.C, iSigDateIndex)) / dsh.Ref(Info.C, iSigDateIndex); if (maxUpF < 0.015 /* || maxUpF > 0.04*/) { return(null); } if (sigDateVol < otherMaxVol * 1.2) { return(null); } if (otherMaxZF + zf > 0) { return(null); } sigInfo = (otherMaxZF + zf).ToString("F4"); if (otherMaxZF + zf < -0.02) { return(null); } if (bHasUpShadowTooHight || bHasDownShadowTooLow) { return(null); } if ( dsh.Ref(Info.ZF, 2) < 0.005 && dsh.Ref(Info.ZF, 3) < 0.005) { return(null); } if (dsh.Ref(Info.C, iSigDateIndex) < dsh.Ref(Info.O, iSigDateIndex)) { return(null); } if (dsh.Ref(Info.C, iSigDateIndex + 1) < dsh.Ref(Info.O, iSigDateIndex + 1)) { return(null); } if (Math.Min(dsh.Ref(Info.ZF, iSigDateIndex), dsh.Ref(Info.ZF, iSigDateIndex + 1)) + dsh.Ref(Info.ZF, iSigDateIndex + 2) < -0.01) { return(null); } var delta = (dsh.Ref(Info.C) - dsh.Ref(Info.O, 1)) / dsh.Ref(Info.C, 1); if (delta > -0.01) { return(null); } var szZF = dsh.SZRef(Info.ZF); if (szZF > 0 && szZF < 0.011 && dsh.SZAcc(Info.ZF, 7, 1) > 0.03) { return(null); } if (!selectBySZ(dsh)) { return(null); } var ret = new Dictionary <String, String>(); ret[String.Format("sumSig/{0}", sumOfSigDateZF > 0.12 ? "1" : "0")] = ""; ret[String.Format("delta/{0}", delta < -0.02 ? "1" : "0")] = ""; ret[String.Format("maxUp/{0}", maxUpF > 0.02 ? "1" : "0")] = ""; ret[String.Format("maxZF/{0}", otherMaxZF + zf > -0.01 ? "1" : "0")] = ""; ret[String.Format("diffzf/{0}", otherMaxZF + zf > -0.02 ? "1" : "0")] = ""; return(ret); }