cBots

Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.
Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
How to install
DescriptionSubmited byDateCategoryPreviewDownloadsCommentsRating
This is almost a complete rewrite of my original Golden Dragon, updated for the current version of cAlgo. I have decided to release it as a new bot rather than updating the existing one because the changes are so extensive. Some functionality has been removed from the first version, and has not yet been fully implemented in this version, or may be included again later on. cAlgo's new optimisation features make tuning this beastie a whole lot easier, but calculating three PRCs does consume a LOT of processor time, so expect to go through several cups of coffee waiting for backtest optimisation results. Expect BUGS! Uses the BelkahayatePRC, Belkahayte Timing and Hull Moving Average custom indicators. Please remember to install and compile them and update the inclusion references in the Golden Dragon before compiling the bot. Parameter Reference These defaults are a reasonable starting point for trading a 5 minute XAUUSD. Don't expect it to work "out of the box" on anything else. Dragon Number - Used to track trades associated with a Dragon instance. Only required if running multiple instances on the same instrument. Assign a unique number to each. [ Default = 1 ] COG Polynomial Degree - Degree for the polynomial regression centre-of-gravity line. A setting of 1 uses a linear regression. 2-4 produce progressively tighter fitting curves [ Default = 3, Range = 1-4, Typically = 3-4 ] 1st, 2nd & 3rd COG Period - Number of bars that the polynomial regressions should be calculated over. The algorithm uses three separate BelkahayatePRC indicators for confirmations and to determine the lot size [ Default = 110, 250 & 465 ] 1st Channel Deviation - Offset distance for the first (inner) channel lines. These lines are used for trade entry selection. [ Default = 1.4 ] 2nd Channel Deviation - Offset distance for the second (intermediate) channel lines. These lines are used for trade entry selection. [ Default = 1.8 ] 3rd Channel Deviation - Offset distance for the third (outer) channel lines. These lines are used for trade entry selection. [ Default = 2.0 ] COG Trade Biasing - When enabled, trades are filtered according to whether the selected COG (1, 2 or 3) is rising (long trades only) or falling (short trades only). [ 0 = Off, Default = 3, Range = 0 - 3 ] Trade Volume - Starting order volume per trade. This value will be doubled or tripled for trades originating outside of the 2nd or 3rd COG channels [ Default = 10 ] Slippage - Specifies the spread allowable per trade entry. [ Default = 10, Attempt Limit Order = 0 ] Stop Loss - Fixed stop loss position relative to trade entry points. [ Default = 1100 pips ] Minimum Profit - Specifies the minimum number of pips to be won on any trade. Trades with dynamic targets will be automatically closed if the target price moves within the minimum profit specified here. [ Default = 50 ] Trailing Stops - Enables trailing stops. [ Default = No ] Trailing Stop Trigger - Distance in pips that price must move from entry before the trailing stop is enabled. [ Default = 500 ] Trailing Stop Distance - Distance from the current price (in pips) for a triggered trailing stop. [ Default = 500 ] Equity Stop Loss - If account equity drops below this proportion of the account balance, then all losing open trades are closed immediately and the Dragon will exit. [ Default = 0.2, Range = 0-1 ] Balance Stop Loss - Proportion of account balance that must be maintained after a loss. Any losses which cause the account balance to drop below this threshold will result in all losing trades to be closed immediately to preserve the account balance at the current level. For example, if this is set to 0.5, the current account balance is $1000, all losing positions will be closed immediately and the Dragon will exit if the account balance drops below $1000x0.5 = $500 on close of any trade. [ Default = 0.2, Range = 0-1 ] Long Trades - Maximum number of long positions which may be simultaneously opened. Higher values increase both profitability and risk. Some markets trade more profitably in one direction than the other. [ Default = 2, Off = 0 ] Short Trades - Maximum number of short positions which may be simultaneously opened. Higher values increase both profitability and risk. [ Default = 2, Off = 0 ] Trade Delay - Minimum number of bars to wait between entering trades. Used primarily to prevent trade "bunching" and manage risk levels. [ Default = 1, Off = 0 ] Wait on Loss - Additional number of bars to wait after losing a trade. New trades will not be entered until the wait period is complete. Useful for dealing with occasional high-volatility. Allows the market time to settle before resuming trading. Values slightly higher than the COG period seem to work quite well. [ Default = 0 = Off ] Martingale Enabled - Specifies whether the Martingale-derived loss recovery strategy will be used. This can be extremely successful because of the high number of consecutive wins achievable, but is not required to achieve a profitable strategy. [ Default = No ] Belkhayate Timing - Uses a Belkahayate Timing indicator for trade entry filtering. [ Default = No ] Hull Trade Filter - Uses a Hull Moving Average to filter trade entry direction. If enabled, will only enter long positions if the HMA is rising, and short positions if it is falling. [ Default = Yes ] Hull Period - Hull Moving Average period in bars. The HMA is used to aid trade entry timing. Long trades are entered when the HMA passes upwards through any of the lower channel lines, using all active COG's as confirmation. Short trades are entered when the HMA passes downwards through any of the upper channel lines. Longer HMA periods result in more reliable entry points, but reduced profit per trade due to later entry. [ Default = 5, Typical Range = 3 - 8 ]
20 May 2015
Downloads
2684
Comments
20
Rating
5
Download
Modified http://ctdn.com/algos/cbots/show/588 to work with OHLC data and only saving bid/ask for tick data. When saving tick data make sure you change data in backtesting options to tick data from server.
by bosma
06 May 2015
Downloads
567
Comments
0
Rating
0
Download
This cBot helps to manage positions. cBot functions: 1. Setup initial stop loss (this this function is not important because cTrader already can do it). 2. Setup breakeven 1 (calculates in appliance with amount of comissions) on level1 3. Close fraction of the position and setup SL in appliance with amount of comissions and remain part. 4. Setup breakeven 2. 5. Tralling position.
11 Apr 2015
Downloads
799
Comments
2
Rating
0
Download
Advisor "MCAD PrbSAR noise" trades on signals indicators MACD and Parabolic SAR, default is optimized on a pair EURUSD H1. You can optimize any instrument and timeframe. Additionally Advisor equipped noise levels on indicators MACD and Parabolic SAR. Closing of open positions occurs on signals indicators MACD and Parabolic SAR only in profits, or - the stop-loss. 1- Noise_Prb_SAR_ema  2- Noise_MACD_m0  3- Noise_MACD_s0  4- Noise_MACD_sm 
18 Mar 2015
Downloads
1184
Comments
4
Rating
0
Download
Hi all,   This the first post of a serie of posts where I'll share my robots. This robot use moving average crossover strategy. The time frame to use is D1 otherwise don't change any other setting. This robot can help you pass the tough times if you use contrarian strategies because it allows you to have a big draw UP  when your contrarian strategy is making a big dawn. In the long term,  the results of this robot are sufficiently positive to not reduce the gain of your main strategy. Here are some back tests results : 
09 Feb 2015
Downloads
1533
Comments
0
Rating
0
Download
Forex Equity Protection works by setting a limit to your drawdown(floating loss) based on a preset percentage of your choice. Protect your Account balance and more importantly your equity with simple software that saves your forex account with equity protection. Limit your losses while trading forex with equity protection which cuts your losses at predefined percentage levels. Forex Equity Protection(FEP) prevents future losses by closing your losing positions without your decision. You can setup the FEP one time on your VPS and protect your account equity from being exposed to unknown forex volatility. More features coming soon  
01 Feb 2015
Downloads
853
Comments
2
Rating
0
Download
The Mechanic Bot uses the Candlestick Tendency indicator as a decision driver for entering trades. The basic idea is to trade higher order timeframe with current local timeframe. It trades a single position at a time and has mechanisms for trailing stops and basic money management. Here's the list of parameters and their descriptions: HighOrderTimeFrame - which higher timeframe to use for deciding on trend direction, default value is h1 (it's ok to leave it like that). This parameter gets forwarded to the Candlestick Tendency indicator. This is recommended to be at least 4x local timeframe. If you use minutes for the main local timeframe, then use minutes over hours for a higher timeframe, or hours over days, days over months etc... Volume - the trading amount, default is 10000, set this to whatever is satisfied by backtesting. EnableStopLoss - the name says it all, default is true to use stoploss mechanism, it's highly recommended to leave it as is (do not turn stoploss off unless you know what you're doing). StopLoss - the stoploss value, in pips, default is 20 (if enabled). EnableBreakEven - use breakeven mechanism or not, default is false (do not move to break even), other breakeven settings only have effect when this setting is true. BreakEvenPips - the amount of pips to set break even stoploss to, default is 10. BreakEvenGain - the minimal amount of profitable pips that triggers a move to break even, default is 20. EnableTrailingStop - use trailing stop mechanism or not, default is false, other trailing stop settings only have effect when this setting is true. TrailingStop - the amount of trailing pips, default is 10 (if enabled). TrailingStart - the minimal amount of profitable pips to start trailing (if enabled). EnableTakeProfit - use the takeprofit mechanism or not, default is true, highly recommended to leave it on. TakeProfit - the amount of take profit pips, default is 30, set this to whatever is satisfied by backtesting. EnterOnSyncSignalOnly - only trade when both local and global trends change direction on the same bar simultaneously, default is true. This setting increases the win/lose ratio, but can reduce the total amount of trades. That is, when this setting is set to true, the bot will make less trades and less mistakes, but this will probably take more time. ExitOnOppositeSignal - exit a position on opposite signal, default is false. This can generate a lot of noise and false signals, so it is recommended to leave it off. Installation: 1. Download and install the Candlestick Tendency indicator. 2. Download and install this bot. 3. Set a reference to Candlestick Tendency in reference manager before building the bot (3rd screenshot) 4. Build the bot.  
28 Jan 2015
Downloads
2609
Comments
6
Rating
2.5
Download
Reversion & Trend trading robot. Utilizes threshold to determine entry. Includes trailing stop loss. Reversion & Trend trading robot. Utilizes threshold to determine entry. Includes trailing stop loss.
06 Jan 2015
Downloads
2225
Comments
13
Rating
5
Download
Il n'y a ici que le money management d'Alembex, à vous d'y rajouter votre technique (les positions sont prises aux hasard sur l'exemple) Montrez vos résultat de ce Money management + votre technique :) Merci MISE A JOUR : - Corrections des bugs - Nouvelles images  avec les tests d'optimisations :  
29 Dec 2014
Downloads
2293
Comments
22
Rating
1.67
Download
Runs as a bot  that writes tick data to a  external CSV file  that can be read by other processes.    I needed this because our AI algorithm exists outside of calgo and needs fresh data every tick to make it's predictions.     I will eventually build the plumbing to allow external buy / sell recommendations to be read back from another stream using a separate bot. For those who want bar data instead of tick data.  Look for DataExportBars. Enhanced 2014-12-21 - Added the num_bid, num_ask and vol_adj_ask, vol_adj_bid columns based on market depth also removed some columns that have values that never changed.   I think  vol_adj_bid and vol_adj_ask show where the market really is with less gaming.  I like this because it shows where the bulk of the real orders are concentrated.   That way the odd sell at a very low or very high price people use to try and game the system are averaged out because they typically do not use large volumes for this kind of gaming.   It may be even better to throw away the statistical outliers and average the rest. Enhanced:2014-12-21 - Reverse spread for vol_adj_price and added a price adjust volume to provide a basic bull vs bear indicator based on where the bulk the open order book is hanging.   When used against backtest it can download historical data.  (See instructions in source) but the Market depth values I use to set num_bid, num_ask, vol_adj_ask, vol_adj_bid are not available during back test which is a real shame because I think these would be really handle for Machine learning algorithms.   The output file name is constructed from the Symbol plus the length of the moving average.  An example is: exp-EURUSD-ma30-ticks.csv   The moving average is included as an additional field just to show how it can be merged with the tick data. Sample Output: date,ask,bid,spread,num_ask,num_bid,vol_adj_ask,vol_adj_bid,vol_adj_spread 2014-12-22 06:51:29.746,1.225520,1.225410,0.000110,11,10,1.225600,1.225347,-0.000252 2014-12-22 06:51:36.527,1.225520,1.225420,0.000100,9,8,1.225590,1.225356,-0.000234 2014-12-22 06:51:44.308,1.225520,1.225430,0.000090,8,10,1.225584,1.225355,-0.000229 2014-12-22 06:51:44.621,1.225520,1.225440,0.000080,7,11,1.225588,1.225357,-0.000231 2014-12-22 06:51:47.621,1.225540,1.225440,0.000100,9,10,1.225594,1.225358,-0.000235 2014-12-22 06:51:49.371,1.225540,1.225460,0.000080,12,9,1.225635,1.225345,-0.000290 2014-12-22 06:51:49.621,1.225550,1.225460,0.000090,12,13,1.225662,1.225332,-0.000330 2014-12-22 06:51:50.371,1.225560,1.225460,0.000100,12,11,1.225675,1.225336,-0.000339 2014-12-22 06:51:50.605,1.225570,1.225460,0.000110,11,13,1.225682,1.225334,-0.000348 2014-12-22 06:51:50.918,1.225550,1.225450,0.000100,11,12,1.225684,1.225337,-0.000348 2014-12-22 06:51:51.168,1.225570,1.225490,0.000080,11,15,1.225667,1.225319,-0.000348 2014-12-22 06:51:51.480,1.225600,1.225520,0.000080,13,12,1.225723,1.225392,-0.000331 2014-12-22 06:51:51.621,1.225620,1.225520,0.000100,11,11,1.225703,1.225413,-0.000290 2014-12-22 06:51:52.418,1.225610,1.225520,0.000090,9,12,1.225676,1.225436,-0.000241 Sample in Excel When ran live can save new inbound ticks to the file as they arrive where a external process can pick them up.   I opened the file in shared mode so both processes can access the file simultaneously. It delivers a poor mans pipe for freshly arriving bar data.    I tested this in Lua and it will sit there waiting for new bars to show up at the end of the file and seems to catch them every time they arrive.     When using in this mode I recommend using a fast SSD or Ramdisk to minimize IO latency to disk. I apologize to those who want to use it internationally since I know the comma delimiter will mess up your formatting.  I tried changing it to a Tab delimited format but then it takes 5 extra clicks to load into excel.  There are only two lines where you have to change the , to tab to make  it work internationally.  I did not try to fix the back fill data problem for ticks like I did with bars because my application did not find them essential.  Let me know if you want this feature we can not duplicate it exactly but should be able to get close except for being able to backfill the gaps between end of back-test and real time.  Note:  To avoid saving ticks that had no order book I added a If Statement if ((volAdjAsk == 0.0) && (volAdjBid == 0.0)) it will have to be commented if you want to use it to download historical bars.  Want to collaborate:     www.linkedin.com/pub/joe-ellsworth/0/22/682/ or     http://bayesanalytic.com No Promises,  No Warranty.  Terms of use MIT http://opensource.org/licenses/MIT
23 Dec 2014
Downloads
1088
Comments
11
Rating
5
Download
Exports chosen bars for Symbol at chosen at the chosen bar size from calgo to CSV file in Directory specified.      Files can be imported by excel but do not open in  when trying to update as excel takes an exclusive lock which will crash the process. OK: Help Needed:   When I run this in Backtest mode with 1 minute bars I get something that looks like valid volumes.  When I run it with 10 tick bars I get the same volume in every bar.    How do we get valid volume for the smaller duration bars.  Question:  How do you convert (MarketSeries.TickVolume to actual Transaction volume for the Bar. I want Total number of units traded during the bar.   I think transaction volume is a more meaningful input for momentum because a small transaction of a fractional unit doesn't mean as much as if a 100 million $ changed hands during the same change in price.  Recommended used is to use the Backtester to download as much historical data as possible in a back-test then switch over to activating the strategy live.  It will auto-backfill the data between end of Backtest and live data but use the Backtest to get as much of the data as possible first as it's lastBar semantic is simplistic.  I have found that tickvolume is only accurate when the Backtest is using the "Tick Data from Server"       The system is smart enough to add new data from current Backtest to end of existing data and it will not overwrite or duplicate the older data but it is not smart enough to detect gaps if the user runs a Backtest covering a couple of months then skips a few months and runs a different Backtest. When used live it will write a new bar whenever a bar has been completed for as long as the cbot is active.    The files are opened in shared mode so a separate process can read new data from them as they arrive.  I needed this because our AI prediction engine needs new data as it arrives and can not run inside of calgo.  I will eventually  write the reverse plumbing to allow predictions from the external engine to be picked up by calgo and executed as trades. When used in back-tester will export the data in the time-frame specified by the backtest.   I tested it back to Jan-1-2011 and all the data seemed to show up.         File name is derived from the symbol, bar duration and chosen moving average and looks like:  exp-EURUSD-Minute-ma3-bars.b1.csv Data  Looks as follows: datetime,open,close,high,low,volume,weighted_val,rsi,stddev,spread 2014-01-27 00:00:00.000,1.368700,1.368630,1.368730,1.368610,23.000000,1.368650,67.318063,0.000223,0.000050 2014-01-27 00:01:00.000,1.368620,1.368590,1.368630,1.368590,15.000000,1.368600,66.005144,0.000282,0.000050 2014-01-27 00:02:00.000,1.368570,1.368860,1.368880,1.368490,41.000000,1.368773,70.226266,0.000365,0.000060 2014-01-27 00:03:00.000,1.368880,1.368980,1.369010,1.368880,29.000000,1.368963,71.896500,0.000438,0.000050 2014-01-27 00:04:00.000,1.368970,1.368980,1.368980,1.368970,4.000000,1.368978,71.896500,0.000483,0.000030 2014-01-27 00:05:00.000,1.369010,1.368810,1.369010,1.368810,20.000000,1.368860,65.829147,0.000504,0.000070 2014-01-27 00:06:00.000,1.368800,1.368610,1.368810,1.368610,28.000000,1.368660,59.470578,0.000500,0.000080 2014-01-27 00:07:00.000,1.368590,1.368970,1.368980,1.368550,36.000000,1.368868,65.862483,0.000511,0.000060 2014-01-27 00:08:00.000,1.368980,1.368990,1.369000,1.368980,6.000000,1.368990,66.181582,0.000512,0.000060 In Excel it looks like: Note: To auto parse the dates when loading in excel change the code to replace T between dateTime with a space. Enhanced Dec-21-2014: To only add bars newer than what are already present in the file but it is still missing the code  to detect gaps and try to fill them in.   Enhanced Dec-212-2014 - To attempt to backfill bars between current bar and the last bar it finds in the file.  This is needed because the the back tester in CAglo always runs a little behind the current data and would create a gap of some very critical missing current data.     This process calculates how many are missing and attempts to backfile from current series.   I have tested it over a weekend but not over longer periods of times.     Want to collaborate:   www.linkedin.com/pub/joe-ellsworth/0/22/682/  or http://BayesAnalytic.com No Promises,  No Warranty.  
22 Dec 2014
Downloads
969
Comments
2
Rating
5
Download
//Momentum WillR% + Hull HMA tendence cBot. cBit also generate an oposite position if it tends to lose. //http://ctdn.com/algos/indicators/show/603   //#reference: ..\Indicators\EHMA.algo //Needs to install: http://ctdn.com/algos/indicators/show/17, Manage references. // //Date: 17/12/2014 //Country: Chile //Copyright: Felipe Sepulveda Maldonado  //LinkedIn: https://cl.linkedin.com/in/felipesepulvedamaldonado //Facebook: https://www.facebook.com/mymagicflight1 //Whats Up: +56 9 58786321 // felipe.sepulveda@gmail.com // //Recomended Timeframe: Minute, for more frequency and accuracy. //Cheers! using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo {     [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]     public class XkaliburBa : Robot     {         #region cBot Parameters         [Parameter("cBot Label", DefaultValue = "XkaliburBa")]         public string cBotLabel { get; set; }         [Parameter("Volume", DefaultValue = 1000, MinValue = 1000)]         public int InitialVolume { get; set; }         [Parameter("Take Profit", DefaultValue = 2, MinValue = 0, MaxValue = 102)]         public double TakeProfit { get; set; }         [Parameter("WilliamsR High", DefaultValue = 70, MinValue = 60, MaxValue = 95)]         public int wHigh { get; set; }         [Parameter("WilliamsR Low", DefaultValue = 30, MinValue = 5, MaxValue = 40)]         public int wLow { get; set; }         [Parameter("WilliamsR Period", DefaultValue = 120, MinValue = 10, MaxValue = 150)]         public int wrPeriod { get; set; }         [Parameter("Zero Loss Inverse (Pips)", DefaultValue = 6, MinValue = 4, MaxValue = 15)]         public int zlInv { get; set; }         [Parameter("EHMA Period", DefaultValue = 12, MinValue = 7)]         public int HullPeriod { get; set; }         [Parameter("Max. Time Open (Minutes)", DefaultValue = 30, MinValue = 5, MaxValue = 120)]         public int maxTime { get; set; }         double TrailingStop;         int nVolume;         string comId;         private EHMA hullMA1;         private EHMA hullMA2;         #endregion         #region cBot Events         protected override void OnStart()         {             hullMA1 = Indicators.GetIndicator<EHMA>(HullPeriod);             hullMA2 = Indicators.GetIndicator<EHMA>(HullPeriod * 6);             Timer.Start(1);         }         protected override void OnTimer()         {         }         protected override void OnTick()         {             double mercado = 100000 * Indicators.AverageTrueRange(MarketSeries, 5, MovingAverageType.VIDYA).Result.Last(0);             double will = 100 + Indicators.WilliamsPctR(wrPeriod).Result.Last(0);             if ((will < wLow) && hullMA1.ehma.IsRising() && hullMA2.ehma.IsRising())             {                 System.Threading.Thread.Sleep(15000);                 ExecuteMarketOrder(TradeType.Buy, Symbol, InitialVolume, cBotLabel, 100, 100, 2);             }             if ((will > wHigh) && hullMA1.ehma.IsFalling() && hullMA2.ehma.IsFalling())             {                 System.Threading.Thread.Sleep(15000);                 ExecuteMarketOrder(TradeType.Sell, Symbol, InitialVolume, cBotLabel, 100, 100, 2);             }             SetTrailingStop(mercado);             ZeroLoss();         }         #endregion         private void SetTrailingStop(double mercado)         {             var sellPositions = Positions.FindAll(cBotLabel, Symbol, TradeType.Sell);             TrailingStop = mercado / 30;             foreach (Position position in sellPositions)             {                 int mPosition = (position.EntryTime.Hour * 60) + position.EntryTime.Minute + maxTime;                 int mActual = (Time.Hour * 60) + Time.Minute;                 double distance = position.EntryPrice - Symbol.Ask;                 if ((distance < TakeProfit * Symbol.PipSize) || (mPosition < mActual))                     continue;                 double newStopLossPrice = Symbol.Ask + TrailingStop * Symbol.PipSize;                 if (position.StopLoss == null || newStopLossPrice < position.StopLoss)                     ModifyPosition(position, newStopLossPrice, position.TakeProfit);             }             var buyPositions = Positions.FindAll(cBotLabel, Symbol, TradeType.Buy);             foreach (Position position in buyPositions)             {                 int mPosition = (position.EntryTime.Hour * 60) + position.EntryTime.Minute + maxTime;                 int mActual = (Time.Hour * 60) + Time.Minute;                 double distance = Symbol.Bid - position.EntryPrice;                 if ((distance < TakeProfit * Symbol.PipSize) || (mPosition < mActual))                     continue;                 double newStopLossPrice = Symbol.Bid - TrailingStop * Symbol.PipSize;                 if (position.StopLoss == null || newStopLossPrice > position.StopLoss)                     ModifyPosition(position, newStopLossPrice, position.TakeProfit);             }         }         private void ZeroLoss()         {             var sellPositions = Positions.FindAll(cBotLabel, Symbol, TradeType.Sell);             foreach (Position position in sellPositions)             {                 double distance = position.EntryPrice - Symbol.Ask;                 double xtp = (double)((position.EntryPrice - position.TakeProfit) / Symbol.PipSize);                 if ((distance < -zlInv * Symbol.PipSize) && (xtp > 90))                 {                     double zlTP = Symbol.Ask - 90 * Symbol.PipSize;                     ModifyPosition(position, position.StopLoss, zlTP);                     switch (position.Volume)                     {                         case 1000:                             nVolume = 2000;                             break;                         case 2000:                             nVolume = 3000;                             break;                         default:                             nVolume = (int)(position.Volume * 2);                             break;                     }                     if (position.Comment != "")                         comId = position.Comment;                     else                         comId = position.Id.ToString();                     ExecuteMarketOrder(TradeType.Buy, Symbol, nVolume, cBotLabel, 100, 100, 2, comId);                 }             }             var buyPositions = Positions.FindAll(cBotLabel, Symbol, TradeType.Buy);             foreach (Position position in buyPositions)             {                 double distance = Symbol.Bid - position.EntryPrice;                 double xtp = (double)((position.TakeProfit - position.EntryPrice) / Symbol.PipSize);                 if ((distance < -zlInv * Symbol.PipSize) && (xtp > 90))                 {                     double zlTP = Symbol.Bid + 90 * Symbol.PipSize;                     ModifyPosition(position, position.StopLoss, zlTP);                     switch (position.Volume)                     {                         case 1000:                             nVolume = 2000;                             break;                         case 2000:                             nVolume = 3000;                             break;                         default:                             nVolume = (int)(position.Volume * 2);                             break;                     }                     if (position.Comment != "")                         comId = position.Comment;                     else                         comId = position.Id.ToString();                     ExecuteMarketOrder(TradeType.Sell, Symbol, nVolume, cBotLabel, 100, 100, 2, comId);                 }             }         }     } }  
18 Dec 2014
Downloads
828
Comments
2
Rating
0
Download