fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. malfy
    3. Posts
    M
    • Profile
    • Following 0
    • Followers 0
    • Topics 7
    • Posts 19
    • Best 1
    • Controversial 0
    • Groups 0

    Posts made by malfy

    • Pair trading suggestions

      Hi There!
      @miro1360 i think i'm going to challenge your skills...

      My broker offers microlots tranding on CFDs like SP500 and Nasdaq. These 2 symbols both move by 0.01 as minimum step and have the same pip value.
      This conditions are perfect for a pair (or spread) trading experiment that can be very profitable (because normally most brokers don't allow microlots so you need big margins to match the pip values of 2 CFDs finding the correct trade volumes.. and there are no currencies being so strictly correlated).

      So the problem is... to create an EA that can trade this strategy, some measurements are needed and i think i have to create something like a "spread" indicator. At first glance I suppose it's impossible to track the relative movement of 2 symbols which have different prices, but it's possible to do it fixing a certain point in time. The idea is this: Nasdaq moves faster than SP500... so, if i recognize that Nasdaq spreads from SP500 more then the middle value of the last x candles, i open a Nasdaq position toward the mean revertions and the opposite position on the SP500.

      My intention is to create a lookback period, to use a cycle to check candles from this period to 1, check the single candles combinations of the 2 symbols (I mean... Symbol A Bull-Symbol B Bull, Symbol A Bear-Symbol B Bear, Symbol A Bull-Symbol B Bear and Symbol A Bear-Symbol B Bull) and then calculate the spread by simple addiction or subtctration of candles close price. (A tick by tick comparison would be better but i think is too complicated to do it).

      Once i have a single candle spread i can then add or subtract the value to the next candle spread, depending on the bear/bull combination and which symbol has generated the biggest candle, and then plot these values as positive or negatives horizontal segments or rectangles... like an histogram... Not an easy task but i think i can do it.

      The major problem is: once i have these values, how can i tell the EA to recognize a mean spread value for the traced period and to open a position when this value is reached? About this point i'm in a big trouble and i hope someone can suggest me a smart idea!

      Thanks!
      D.

      posted in Questions & Answers
      M
      malfy
    • RE: Counter to check past candles conditions

      Thanks Roar,

      Your workaround it's certainly less complicated but is not what i want, because you are counting each bar waiting for the condition to buy, while i want a "picture" of X past bars at every new bar.
      Anyway you suggested me where to focus my attention, and i discovered that i was using the wrong counter block. Using Loop (Pass "n" times) it works!

      That's the right version:
      https://fxdreema.com/shared/z2aQGGpae

      posted in Questions & Answers
      M
      malfy
    • Counter to check past candles conditions

      Hi there!

      I'm trying to realize this idea: if a certain number of past bars closed below the middle bollinger band and the last bar closed above, then buy.

      I tried to do this using a counter "Count n then pass". The idea is this: if i want to count 5 bars under bollinger middle line i need to check 6 bars... 5 under bollinger and 1 above bollinger, so i set a constant (COUNTER CYCLES) equal to 6-2=4. Then i set a variable (ID) equal to the (COUNTER CYCLES)+2.
      The counter should check the condition Candle Close < Bollinger Middle at the candle ID = (ID), if is true, set (ID)=(ID)-1. When the counter passes, If all the past candles closed below the bollinger then (ID) must be == 2 and i just have to check if the last candle closed above and eventually buy.

      This is the project: shared/1g4dy10Hc

      My problem is that the variable (ID) goes immediatly to -1 which should be impossible... if the counter passes 4 times and (ID) is initialized to 4+2 it should never go under 2. I can't get the reason.
      Probably i did a wrong use of the counter. To realize this idea i connected to the yellow dot a "run blocks" command to run the candle condition check.

      Can someone tell me where i'm wrong?

      posted in Questions & Answers
      M
      malfy
    • Closing oldest trades on specific event

      Hi there!

      I want to test a trading system where losable trades are never closed unless they are compensated.
      To do this, when i open a new trade i also open an opposite pending at the distance of my wanted "stop loss". In this way, when the trade goes bad, i freeze the loss by hedging. Then, every new trade has a trailing stop with same size of the pips distance between each hedging couple. What i want to do is to close the oldest couple of hedging trades each time that the trailing stop moves the SL.
      I wrote the system and it seems to be ok unless that i can't close the oldest couple of orders.
      I tried to realize it using a "trade SL modified" under "on trade" section. I connected a loop to this block where the sequence is: for each trade, oldest to newest, no more than 2 trades, close trades... but this is not working
      I also tried to place the same loop "on tick", with using other ways to identify the condition where oldest orders must be closed but i have no results.

      Where is the mistake? Or... what could be the right way to achieve the result?
      Here the link to the project: https://fxdreema.com/shared/obdqfrjjb

      Thanks for the help and happy sunday!
      Malfy

      posted in Questions & Answers
      M
      malfy
    • RE: Keeping data after a crash

      Thanks FxDreema,
      i get your suggestion. Unfortunately i need at least one data (the last closed trade profit) to be stored somewhere.
      I'll try to study the terminal variables or maybe i can write it in a log file and use a constant that in some ways overrides the EA if contains a value greater than 0.

      I'm a bit in trouble about reading the last closed trade profit. The "Check Profit" block only compares the profit with a value.
      Can i use a formula with "(On trade) Event Data" - Profit, or the only way is to compare the current balance to the last balance?

      posted in Questions & Answers
      M
      malfy
    • Keeping data after a crash

      Hi there!

      I'm thinking about a special money management that makes calculation on each single trade profit to evaluate the risk for the next one. In order to do this, i need to act in relation to the starting account balance when the EA is attached to the chart for the first time, and i also need to always have the last trade data in a variable.
      But... an EA like that needs to keep some data that can be lost in case of a system crash or if a platform restart is required for any reason.

      There's a way to store these data somewhere and tell the EA to read them when is restarted?

      posted in Questions & Answers
      M
      malfy
    • RE: Lag between EA and server

      I found out that the VPS time is 5 seconds earlier than broker's time. So that's the reason... and this also means that "GMT" option in the hout filter block is related to the local machine. I will change it to "server" and i'll add a GMT correction constant or... maybe, i guess i can set a formula and a variable to read the market conditions and automatically align the server time to the local machine time 🙂

      posted in Questions & Answers
      M
      malfy
    • RE: just losses

      When you look for this strategy on the net, you find that someone says to start measuring the night range from 23.00 of the previous day, someone else says you just need 4 hours before the session opens... someone else talks about just half an hour before.
      So... the better thing to do, imho, is to assign a constant to the candle ID that you are looking back. In this way you can do multiple backtests or run the optimization to find what value works better.
      Same for the start time... you can see if is better to shift it a little backward or a little forward.
      Nothing changes about the EA behaviour, it's just a matter of tweaking it.

      posted in Questions & Answers
      M
      malfy
    • RE: Lag between EA and server

      @fxDreema yes you're right, i have 2 EA working on the same demo account. The problem can be related to this?
      I know about the local/server option but i chose the third one... "GMT", because i hoped to be always in sync with the London session without caring about the server time zone.

      posted in Questions & Answers
      M
      malfy
    • RE: Place 3 Break even

      Sorry i was wrong... To do this it must be Trailing Stop = 15, Trailing step = 10 and Trailing start = (Open Price - 5).

      Try it. If you want to stop trailing the stop after 40 pips you should think about something like a flag to be checked after the profit reaches 40 pips.

      posted in Questions & Answers
      M
      malfy
    • RE: Place 3 Break even

      Maybe i'm saying something stupid but... 20-5=15, 30-15=15, 40-25=15
      It isn't just a 15 pips trailing stop with a 5 pips trailing step starting at price level?

      posted in Questions & Answers
      M
      malfy
    • RE: just losses

      Yes eranger 🙂 You got it. I mean they are input parameters... nothing special.

      posted in Questions & Answers
      M
      malfy
    • Lag between EA and server

      Hello!

      I'm testing my first EA on a demo account. The EA is that London opening yet discussed here.
      It happens something weird in the morning when the robot is activated.
      It is supposed to start at 8:00 GMT by an hour filter (active from 8:00 to 8:10 in TF15), then it executes a "once per bar" sequence: identify a price range, trace a rectangle on the graph and, if conditions are ok it places pending orders.
      Everything's fine in back test but in the live demo it does everything twice (2 rectangles and 4 pendings): looks like the EA begin to work few seconds before the 8:00 bar is opened... so the once per bar sequence is executed along the last seconds of the 7:45 bar and then again for the correct bar. It's very fast, watching the platform in that moment it seems that actions are simultaneous, but the 2 range rectangles are traced starting from 2 different bars so i'm almost sure that my hypotesis is right.
      I can solve this by shifting the hour filter 30 seconds or 1 minute forward but... i'm guessing why this happens.
      The hour filter is related to the server time or the local machine time?

      posted in Questions & Answers
      M
      malfy
    • RE: just losses

      I don't remember exactly what happened during brexit, but it was at night so probably the ea wasn't working because i'm closing loosable trades at 18.30 of each day.
      Anyway... this is my result for 2016... still far from any kind of optimization.

      0_1489531257090_GBPUSD 2016.jpg

      I'm using parametric lookback time, parametric orders offset (to avoid fake price moves) and also an SL reduction factor, because i saw during backtests that often when the price goes down over 50% on the negative side it doesn't come back.
      EURGBP also gives good results but night ranges are smaller, it seems every pair needs a dedicated optimization.
      Anyway... i'm still working on it.

      I'm also thinking about an EA based on the same principle but "always on"... i mean, something that is continuously looking back for a number of bars, checks the range and when the range is low enough places the pendings for a breakout.
      It can be a good way to trade a 5 minutes chart, maybe using Ichimoku to predict a probable breakout direction. But at the moment it's too complicated for me... i need to practice a little more 🙂

      posted in Questions & Answers
      M
      malfy
    • RE: just losses

      Hello Piroozmand,

      i'm new too in strategy automation and i have to agree that is difficult to have results. The London daybreak is profitable for me, but my EA is still very rough and needs fine tuning and optimization.
      What i did to have results is consequence of an error... my first version wasn't able to close the trades and i saw that some of them were going dramatically in profit if they were to the "right side". So i began to change the EA in something hybrid... and i'm not being able to do it yet because i can't undestand a lot of the "trailing stop" block functions.... If i use pips it's ok, when trying with % of various things it becomes difficult to understand how things are working.
      Anyway the concept is that the London opening is presented as a 1/1 or 2/1 R/R intraday strategy, and results are not so good. But... what if don't use TP at all? Imagine to work with a 2:1 "virtual TP"; when price reaches TP your SL goes at TP/2 and your 1:1 is ensured. Then you start trailing with large parameters leaving the EA to follow the price as long as needed. Backtests seems to be promising in this way.

      Another thing i discovered while backtesting is that seems to be a "non sense" to trade a % of balance as risk. That's because, even if you are using a 4:1 R/R strategy, when you have a serie of losses, then you are no more trading the same amount of money and your 4:1 is no more true. It seems to be far better to trade fixed lots unless you find a strategy with a very high number of winning trades.

      I'm curious to know other user's experiences too 🙂

      posted in Questions & Answers
      M
      malfy
    • RE: Opening Range Breakout: something wrong, but how to find it?

      Thanks! I understood and solved the problem 🙂 I also changed the trade managing using an "on trade" condition.
      Now the strategy is working fine, even if i'm still in trouble understanding the trailing stop configuration.
      I'm going to look if i can find some discussions about it in the forum.

      posted in Questions & Answers
      M
      malfy
    • Opening Range Breakout: something wrong, but how to find it?

      Hi There!

      I'm trying to build a very basic London Opening Breakout EA.
      I think the logic is right and there are no errors when compiling but... when i test it nothing happens; i can't see any pending order. Here's the project:
      https://fxdreema.com/shared/l2Q6QwUHd

      I decided to insert a comment block just to understand something more.
      The Hour Filter is working because the comment is shown on the graph... so probably there's an error in the "check trading conditions" block...

      In this block i'm comparing the variable "NR", that is a price difference (maximum-minimum price of the last 40 candles on a 15min chart), with an input constant "Max_NR" considered as "pip value" and "price fraction". I'm checking if NR <= Max_NR.
      What can be wrong here?

      Thanks!
      Malfy

      posted in Questions & Answers
      M
      malfy
    • RE: Indicator average value & Ichimoku

      Thanks so much Miro!
      I'm going to study your answers deeply.

      I suppose that this lookback function can also be usefull to find price maximum and minimum to identify a trend or support and resistence levels.
      It's interesting because there's a profitable strategy that we are discussing in an italian forex group, that is based on a breakout after a sequence of Higher High and Higher Lows and viceversa.

      About the Ichimoku, usually kumo lines are shifted forward 26 periods, so if 1 is the last closed candle and 0 is the current, probably the correct value to check the kumo created by the last closed candle is -24. I will test it 🙂

      posted in Questions & Answers
      M
      malfy
    • Indicator average value & Ichimoku

      Hi there!
      I've just began my adventure with fxdreema and i'm trying to build my first EA. I saw there's a lot of youtube videos and examples and it seems easy to do it but there are a pair of things that i can't figure out.

      I'm planning to analyze the range of the last closed candle and tell the EA to do something if High-Low is <= a specific value. This value comes from the average value of the ATR over a certain period x. So... i need to extract the value [ATR(x) Max + ATR(x) Min]/2. How can i do this?

      Another thing that is not clear is about the Ichimoku indicator and the position of the shifted lines. I mean... if i want to tell the EA to evaluate if the forwarded Kumo is bullish or bearish i can simply check if Senkou Span A > Senkou Span B but what candle ID i have to use? Can i use negative values to look forward?

      Thanks for the help!
      Daniele

      posted in Questions & Answers
      M
      malfy
    • 1 / 1