Skip to content

Commit

Permalink
patterns paint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWan committed Oct 21, 2023
1 parent fda876f commit afbe7af
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 20 deletions.
48 changes: 44 additions & 4 deletions project/OsEngine/Charts/CandleChart/WinFormsChartPainter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2868,6 +2868,11 @@ public void PaintPoint(PointElement point)
/// </summary>
void _chartForCandle_MouseMove2ChartElement(object sender, MouseEventArgs e)
{
if (IsPatternChart)
{
return;
}

if (_chart.Cursor != Cursors.SizeAll)
{
// if user hasn't pinched the item
Expand Down Expand Up @@ -2971,6 +2976,11 @@ void _chartForCandle_MouseMove2ChartElement(object sender, MouseEventArgs e)
/// </summary>
private void _chartForCandle_MouseDown2ChartElement(object sender, MouseEventArgs e)
{
if (IsPatternChart)
{
return;
}

if (_chartElements == null)
{
return;
Expand Down Expand Up @@ -3064,6 +3074,11 @@ private void _chartForCandle_MouseDown2ChartElement(object sender, MouseEventArg
/// </summary>
void _chartForCandle_MouseUp2ChartElement(object sender, MouseEventArgs e)
{
if (IsPatternChart)
{
return;
}

try
{
if (_clickElement == null)
Expand Down Expand Up @@ -4411,14 +4426,16 @@ void _chart_Click(object sender, EventArgs e)
{
try
{
if (_chart.Cursor == Cursors.SizeAll)
if (IsPatternChart)
{
return;
}
if (IsPatternChart)

if (_chart.Cursor == Cursors.SizeAll)
{
return;
}

if (_myCandles == null ||
_myCandles.Count == 0)
{
Expand Down Expand Up @@ -5156,10 +5173,16 @@ public void ShowAreaOnChart()

private void _chart_MouseMove(object sender, MouseEventArgs e)
{
if (IsPatternChart)
{
return;
}

if (_chart.Cursor == Cursors.SizeAll)
{
return;
}

if (_chart.ChartAreas.Count < 2)
{
return;
Expand Down Expand Up @@ -5280,10 +5303,16 @@ private void _chart_MouseMove(object sender, MouseEventArgs e)

private void _chart_MouseMove2(object sender, MouseEventArgs e)
{
if (IsPatternChart)
{
return;
}

if (_chart.Cursor == Cursors.SizeAll)
{
return;
}

if (_chart.ChartAreas.Count < 1)
{
return;
Expand Down Expand Up @@ -6007,6 +6036,11 @@ private void _chart_MouseWheel(object sender, MouseEventArgs e)
/// </summary>
void _chartForCandle_MouseUp(object sender, MouseEventArgs e)
{
if (IsPatternChart)
{
return;
}

_mouseDown = false;
_chart.Cursor = Cursors.Default;
}
Expand All @@ -6017,15 +6051,16 @@ void _chartForCandle_MouseUp(object sender, MouseEventArgs e)
/// </summary>
private void _chartForCandle_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left)
if (IsPatternChart)
{
return;
}

if (IsPatternChart)
if (e.Button != MouseButtons.Left)
{
return;
}

_mouseDown = true;
// accept event on the right side of host
// принимаем событие в правой части хоста
Expand Down Expand Up @@ -6101,6 +6136,11 @@ void _chartForCandle_MouseMove(object sender, MouseEventArgs e)
{
try
{
if (IsPatternChart)
{
return;
}

if (_chart.Cursor != Cursors.Hand)
{
return;
Expand Down
4 changes: 2 additions & 2 deletions project/OsEngine/OsMiner/Patterns/PatternController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Collections.Generic;
using System.Threading;
using System.Windows;
using System.Windows.Forms.DataVisualization.Charting;
using System.Windows.Forms.Integration;
using System.Windows.Shapes;
using OsEngine.Charts;
Expand Down Expand Up @@ -1630,7 +1631,7 @@ public void PaintPrimeChart()
_volume = (Volume)_chart.CreateIndicator(_volume, "VolumeArea");
}
_volume.Process(series.Candles);

}

/// <summary>
Expand Down Expand Up @@ -1781,7 +1782,6 @@ private void PaintSinglePattern(IPattern pattern, WinFormsChartPainter chart)
}
}
}

}

/// <summary>
Expand Down
58 changes: 44 additions & 14 deletions project/OsEngine/bin/Debug/BotsDescriprion.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,58 @@
BollingerTrailing&Bollinger Bands trading bargaining robot with pull-up Trailing-Stop through Bollinger Bands Buy: 1. The price is more than BollingerUpLine. Sell: 1. Price below BollingerDownLine.Exit: 1. Trailing-Stop through Bollinger Bands&Include&&Simple 1*&Bollinger*&
BbPowerTrade&Trend strategy based on two indicators BullsPower and BearsPowerBulls + Bears is less than negative Step - close the position and enter Short. Bulls + Bears more than Step - close the position and enter Long.&Include&&Simple 1*&BearsPower*BullsPower*&
BollingerRevers&Trend Strategy Based on Breaking Bollinger Lines Buy: 1. The price is more than BollingerUpLine. Sell: 1. Price below BollingerDownLine.Exit: 1. At the intersection of Sma with the price&Include&&Simple 1*&Bollinger*&
BollingerTrailing&Bollinger Bands trading bargaining robot with pull-up Trailing-Stop through Bollinger Bands Buy: 1. The price is more than BollingerUpLine. Sell: 1. Price below BollingerDownLine.Exit: 1. Trailing-Stop through Bollinger Bands&Include&&Simple 1*&Bollinger*&
BlockIndicatorsSample&Example showing the blocking of indicators for calculation&Include&&Simple 1*&Bollinger*Sma*PriceChannel*&
Bollinger&The Countertrend robot Buy: 1. Price below BollingerDownLine. Sell: 1. The price is more than BollingerUpLine. Exit: 1. At the intersection of Sma with the price&Include&&Simple 1*&Bollinger*MovingAverage*&
ClusterEngine&blank strategy for manual trading&Include&&Cluster 1*&&
ClusterCountertrend&The Countertrend robot Buy: we buy if we are under the largest volume for sale in the last 10 candles. Sell: sell if we are above the largest purchase volume for the last 10 candles. Exit logic: By return signal.&Include&&Simple 1*Cluster 1*&&
CciTrade&Counter Trend Strategy Based on CCI Indicator. Max - 3 poses Buy: 1. CCI is less than DownLine. Sell: 1. CCI more UpLine. Exit: on the return signal.&Include&&Simple 1*&CCI*&
CustomParamsUseBotSample&&Include&&Simple 1*&Sma*Sma*ATR*&
CurrencyArbitrageClassic&A robot for classic currency arbitrage&Include&&Polygon 1*&&
CurrencyMoveExplorer&Robot for research. Saves slices of the situation on the bundle of instruments within 3 seconds after receiving a signal that there is profit on the sequence.&Include&&Polygon 1*&&
Engine&blank strategy for manual trading&Include&&Simple 1*&&
EnvelopTrend&Trend strategy based on indicator Envelop. Entrance to Long: entry when the price crosses the upper border of the channel. Entrance to Short: entry when the price crosses the lower border of the channel. Exiting a Long position: by trailing stop. Exit from a Short position: by trailing stop.&Include&&Simple 1*&Envelops*&
ElementsOnChartSampleBot&&Include&&Simple 1*&MACD*&
EnginePair&blank strategy for manual pair trading&Include&&Pair 1*&&
Fisher&Fisher based on multithreading Entering a position - we are waiting for a sharp price deviation by the specified number of percent from the edge of the order book. Exit a position when the price rolls back by 50 percent or more of the entry price. Those. if the price has returned half or more of the original movement.&Include&&Simple 1*&Sma*&
HighFrequencyTrader&robot analyzing the density of the market depth&Include&&Simple 1*&&
CustomParamsUseBotSample&&Include&&Simple 1*&Sma*Sma*ATR*&
BbPowerTrade&Trend strategy based on two indicators BullsPower and BearsPowerBulls + Bears is less than negative Step - close the position and enter Short. Bulls + Bears more than Step - close the position and enter Long.&Include&&Simple 1*&BearsPower*BullsPower*&
BlockIndicatorsSample&Example showing the blocking of indicators for calculation&Include&&Simple 1*&Bollinger*Sma*PriceChannel*&
ClusterCountertrend&The Countertrend robot Buy: we buy if we are under the largest volume for sale in the last 10 candles. Sell: sell if we are above the largest purchase volume for the last 10 candles. Exit logic: By return signal.&Include&&Simple 1*Cluster 1*&&
FundBalanceDivergenceBot&The countertrend bots Buy: 1. FBD more Indicator Divergence. Sell: 1. FBD is less than negative Indicator Divergence. Exit: after N number of days.&Include&&Simple 1*&FBD*&
GridSample&Logic of the first Buy: if there are N candles falling down, we place the first order according to the close of the last candle. Next: buy if the price is greater than entryUpPrice or less than entryDownPrice. Exit: by stop&Include&&Simple 1*&&
HighFrequencyTrader&robot analyzing the density of the market depth&Include&&Simple 1*&&
MomentumMACD&Trend strategy based on 2 indicators Momentum and Macd. if lastMacdUp < lastMacdDown and lastMom < 100 - close position and open Short. if lastMacdUp > lastMacdDown and lastMom > 100 - close position and open Long.&Include&&Simple 1*&MacdLine*Momentum*&
MarketMakerBot&&Include&&Simple 1*&&
MacdRevers&Trend strategy at the intersection of the MACD indicator Logic of the first Enter: lastMacdDown < 0 and lastMacdUp > lastMacdDown - Buy lastMacdDown > 0 and lastMacdUp < lastMacdDown - Sell Next: lastMacdDown > 0 and lastMacdUp < lastMacdDown close position and open Short. lastMacdDown < 0 and lastMacdUp > lastMacdDown close position and open Long.&Include&&Simple 1*&MACD*&
MacdTrail&Trend strategy based on the Macd indicator and trail stop Logic Enter: lastMacdDown < 0 and lastMacdUp > lastMacdDown - Buy lastMacdDown > 0 and lastMacdUp < lastMacdDown - Sell Exit: By TralingStop&Include&&Simple 1*&MacdLine*&
OneLegArbitrage&Trading robot on the index. The intersection of MA on the index from the bottom up long, with the reverse intersection of shorts&Include&&Simple 1*Index 1*&Sma*&
PairTraderSimple&robot for pair trading. trading two papers based on their acceleration to each other by candle&Include&&Simple 2*&&
PatternTrader&Pattern trading robot&Include&&Simple 1*&&
PriceChannelTrade&Trend strategy on interseption PriceChannel indicator. if PriceLow < _lastPriceChDown - close position and open Short. if PriceHigh > _lastPriceChUp - close position and open Long.&Include&&Simple 1*&PriceChannel*&
PairTraderSpreadSma&pair trading robot building spread and trading based on the intersection of MA on the spread chart SmaLong crossed SmaShort from top to bottom - the first tab sells, the second one buys. SmaLong crossed SmaShort from the bottom up - the first one is buying, the second one is selling. Exit: on the opposite signal&Include&&Simple 2*Index 1*&MovingAverage*MovingAverage*&
ParabolicSarTrade&Trend strategy at the intersection of the ParabolicSar indicator. if Price < lastSar - close position and open Short. if Price > lastSar - close position and open Long.&Include&&Simple 1*&ParabolicSaR*&
PivotPointsRobot&&Include&&Simple 1*&PivotPoints*&
PinBarTrade&&Include&&Simple 1*&MovingAverage*&
PairRsiTrade&Pair trading based on the RSI indicator Logic: if RsiOne > RsiTwo + RsiSpread - then we are Sell on the first instrument and Buy on the second one. Logic: if RsiTwo > RsiOne + RsiSpread - then we are Buy on the first instrument and Sell on the second one. Exit: on the return signal.&Include&&Simple 2*&RSI*RSI*&
PriceChannelBreak&When the candle is closed outside the PriceChannel channel, we enter the position, the stop loss is at the extremum of the last candle from the entry candle, take profit by the channel size from the close of the candle at which the entry occurred&Include&&Simple 1*&PriceChannel*&
TimeOfDayBot&TimeOfDayBot. We choose which position we want to open Sell and Buy and set the entry time. Exit: by stop and profit %.&Include&&Simple 1*&&
Williams Band&&Include&&Simple 1*&Alligator*Fractal*AwesomeOscillator*&
MacdRevers&Trend strategy at the intersection of the MACD indicator Logic of the first Enter: lastMacdDown < 0 and lastMacdUp > lastMacdDown - Buy lastMacdDown > 0 and lastMacdUp < lastMacdDown - Sell Next: lastMacdDown > 0 and lastMacdUp < lastMacdDown close position and open Short. lastMacdDown < 0 and lastMacdUp > lastMacdDown close position and open Long.&Include&&Simple 1*&MACD*&
PriceChannelVolatility&Breakthrough of the channel built by PriceChannel + -ATR * coefficient, additional input when the price leaves below the channel line by ATR * coefficient. Trailing stop on the bottom line of the PriceChannel channel&Include&&Simple 1*&PriceChannel*ATR*&
ElementsOnChartSampleBot&&Include&&Simple 1*&MACD*&
PairCointegrationSideTrader&The robot trades on a chart of deviations of one instrument from another, calculated through their difference with the multiplier. Two lines, calculated from the standard deviation multiplied by the multiplier, are superimposed on this graph (Cointegration). Above and below zero. When the current deviation is higher than the upper line on the deviation chart - we enter a position expecting the instruments to converge. We close the previous position. When the current deviation is below the bottom line on the Deviation chart - enter the position, counting on the instruments convergence. Closing the previous position.&Include&&Pair 1*&&
PairCorrelationNegative&Bot - trading pairs in the trend If the correlation is below -0.8 and we are on some side of the cointegration - enter counting on a further spread. Exit - when correlation rises above 0.8&Include&&Pair 1*&&
PairCorrelationTrader&if the correlation is higher than 0.9 and we are on some side of the cointegration - enter, counting on the pair convergence Exit by the inverse cointegration signal&Include&&Pair 1*&&
PolygonalEngine&blank strategy for manual currency trading&Include&&Polygon 1*&&
RsiContrtrend&Robot based on RSI indicator and moving average, trading by counter-trend logic. Short entry - when RSI is above the signal line and SMA is above the current price&Include&&Simple 1*&MovingAverage*Rsi*&
RsiTrade&RSI's concurrent overbought and oversold strategy Logic: if RsiSecond <= DownLine - close position and open Long. Logic: if RsiSecond >= UpLine - close position and open Short.&Include&&Simple 1*&RSI*&
TwoLegArbitrage&Pair trading based on index analysis. Buy: when the RSI indicator built on the index goes below the oversold level. Sell: when the RSI indicator built on the index goes above the oversold level. Exit: by reverse system.&Include&&Simple 2*Index 1*&Rsi*&
FundBalanceDivergenceBot&The countertrend bots Buy: 1. FBD more Indicator Divergence. Sell: 1. FBD is less than negative Indicator Divergence. Exit: after N number of days.&Include&&Simple 1*&FBD*&
MacdTrail&Trend strategy based on the Macd indicator and trail stop Logic Enter: lastMacdDown < 0 and lastMacdUp > lastMacdDown - Buy lastMacdDown > 0 and lastMacdUp < lastMacdDown - Sell Exit: By TralingStop&Include&&Simple 1*&MacdLine*&
PairRsiTrade&Pair trading based on the RSI indicator Logic: if RsiOne > RsiTwo + RsiSpread - then we are Sell on the first instrument and Buy on the second one. Logic: if RsiTwo > RsiOne + RsiSpread - then we are Buy on the first instrument and Sell on the second one. Exit: on the return signal.&Include&&Simple 2*&RSI*RSI*&
RviTrade&Trend strategy at the intersection of the indicator RVIBuy: lastRviDown < 0 and lastRviUp > lastRviDown. Sell: lastRviDown > 0 and lastRviUp < lastRviDown. Exit: By return signal&Include&&Simple 1*&RVI*&
SmaScreener&If there is a position, exit by trailing stop. If there is no position. Open long if the last N candles we were above the moving average&Include&&Screener 1*&Sma*&
ScreenerEngine&blank strategy for manual trading&Include&&Screener 1*&Sma*&
SmaTrendSample&Trend robot SmaTrendSample Buy: lastCandlePrice > smaValue and lastCandlePrice > upChannel.Sell: lastCandlePrice < smaValue and lastCandlePrice < downChannel.Exit: By TralingStop&Include&&Simple 1*&Sma*Envelops*&
SmaStochastic&Trend strategy based on 2 indicators Sma and RSI. if lastClose > lastSma + Step and secondLastRsi <= Downline and firstLastRsi >= Downline - Enter Long. if lastClose < lastSma - Step and secondLastRsi >= Upline and firstLastRsi <= Upline - Enter Short. Exit Long: lastClose < lastSma - Step. Exit Short: lastClose > lastSma + Step.&Include&&Simple 1*&MovingAverage*StochasticOscillator*&
TwoLegArbitrage&Pair trading based on index analysis. Buy: when the RSI indicator built on the index goes below the oversold level. Sell: when the RSI indicator built on the index goes above the oversold level. Exit: by reverse system.&Include&&Simple 2*Index 1*&Rsi*&
ThreeSoldier&Trading robot Three Soldiers. When forming a pattern of three growing / falling candles, the entrance to the countertrend with a fixation on a profit or a stop&Include&&Simple 1*&&
TimeOfDayBot&TimeOfDayBot. We choose which position we want to open Sell and Buy and set the entry time. Exit: by stop and profit %.&Include&&Simple 1*&&
TinkoffGetRealCandlesSample&&Include&&Simple 1*&&
TestBotCandlesComparison&&Include&&&&
TestBotConnection&Do not turn on - robot for connection testing&Include&&Screener 1*&Sma*&
TestBotOpenAndCanselOrders&&Include&&&&
TestBotTradesInCandlesTest&Do not enable - a robot for testing the synchronism of the array of trades in the candle and the candles themselves&Include&&Screener 1*&Sma*&
Williams Band&&Include&&Simple 1*&Alligator*Fractal*AwesomeOscillator*&
WilliamsRangeTrade&Counter Trend Strategy Based on Willams% R Indicator Buy: 1. Williams Range is smaller than DownLine. sell: 1. Williams Range is larger than UpLine. exit: 1. On the return signal&Include&&Simple 1*&WilliamsRange*&
WServerTester&&Include&&&&
ADDivergence&The trend robot on AD indicator divergence and price. Buy: at the price, the minimum for a certain period of time is below the previous minimum, and on the indicator, the minimum is higher than the previous one. Sell: on the price the maximum for a certain period of time is higher than the previous maximum, and on the indicator the maximum is lower than the previous one.Exit: after n number of candles.&Script&&Simple 1*&ZigZagAD*ZigZag*&
ADXBreakPlusMinus&The trend robot on strategy ADX Break Plus Minus. Buy: 1. DM+ crossed DM- from bottom to top. 2. ADX is more than DM-. 3. ADX rising. Sell: 1. DM+ crossed DM- from top to bottom. 2. ADX is more than DM+. 3. ADX rising. Exit: by DM reverse intersection.&Script&&Simple 1*&ADX*&
Expand Down
Binary file modified project/OsEngine/bin/Debug/OsEngine.exe
Binary file not shown.

0 comments on commit afbe7af

Please sign in to comment.