Buy scenario - Stop Orders only - works. Check that one off...
Still no answer on Buy scenario - Limit orders only.
Still no answer on Buy scenario - Limit orders only.
What is better to learn, MQL or AFL (Amibroker)?? 14 replies
starting with c++ before mql.. how much c++ should one learn? 2 replies
I Will Learn Coding in 1 Month - Give me the 80/20 of MT4 Coding 14 replies
MQL Coding - Let’s talk about how to code mql 0 replies
Book to Learn MQL? 8 replies
1 Sell Scenario.
1.1 Limit Orders only. => Verified, OK
1.2 Stop Orders only. => Verified, OK
1.3 Limit & Stop orders. => Verified, OK
2 Buy Scenario.
2.1 Limit Orders only. => Verified, OK
2.2 Stop Orders only. => Verified, OK
2.3 Limit & Stop orders. => Verified, OK
...DislikedFinally... I can say with confidence that the Buy Scenario - Limit Trades Only - WORKS fine. Check that puppy off the list! You know - what would really be nice would be to have some kind of audible when a scenario initiates it's first order so that it would call my attention back to it. Also maybe an audible when all open trades in a series become profitable... Don't know how much work that would be, I'm just dreaming of perfection - and that is just a suggestion - not a request.Ignored
DislikedGreat thread you have here, congratulations! Do you know a quicker way to debug MQL code besides using the "print" or "comment" functions. I know about using the "debugview" tool also but I was wondering if you happen to be using something better for a more structured approach to debugging and testing. thanks!Ignored
DislikedHey ya broketrader! Since you have been busy helping mindy with her expert, I had posted a question about an issue over on stackoverflow. It seems nobody over there has any ideas. Granted, this is a very odd situation. Basically, I have finished my indicator, and now the indicator cannot find the function in the dll. I have verified, with a program called the Dependency Walker, that the function name has not been mangled during the export. In short, I cannot find any reason why the indicator cannot find the function name. If you are interested in...Ignored
// Declaration extern "C" MT4_EXPFUNC bool __stdcall LiveChart( bla, bla, bla ); // Definition MT4_EXPFUNC bool __stdcall LiveChart( bla, bla, bla ) { Observatory astronomer; return astronomer.OnCalculateLive( bla, bla, bla ); }
Disliked{quote} From what I see, there is no declaration of the function but only it's body. Try this in your dll source : // Declaration extern "C" MT4_EXPFUNC bool __stdcall LiveChart( bla, bla, bla ); // Definition MT4_EXPFUNC bool __stdcall LiveChart( bla, bla, bla ) { Observatory astronomer; return astronomer.OnCalculateLive( bla, bla, bla ); }Ignored
extern "C" MT4_EXPFUNC bool __stdcall LiveChart(const BarTrack &bars, Stars &points, Patterns *gartleys, Patterns *bats, Patterns *butterflies, Patterns *cyphers, const BarData *rates, Basics &basics);
QuoteDislikedIntelliSense: linkage specification is incompatible with previous "LiveChart"
DislikedHi MehZhure, Sometimes some lines of code are better than a thousand words. Could you post a little example of your C and C# code that makes your Ninjatrader to crash, so I can replicate locally ? It's long time I haven't played with C#/C++ so it's difficult to respond as is.Ignored
#define WIN32_LEAN_AND_MEAN #include "stdafx.h" #include <windows.h> #include <stdlib.h> #include <stdio.h> BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } struct TestStruct { int x, y; } testy[2]; extern "C" __declspec(dllexport) TestStruct __stdcall TestFunk(int *x, int *y)//TestStruct **testy ) { testy[0].x = x[0] + 1; testy[0].y = y[0] + 1; testy[1].x = x[1] + 1; testy[1].y = y[1] + 1; return &testy; }
namespace NinjaTrader.Indicator { public class TestIndicator : Indicator { [StructLayout(LayoutKind.Sequential)] public struct TestStruct { public int x, y; } TestStruct[] testy = new TestStruct[2]; int[] x = new int[2]; int[] y = new int[2]; protected override void Initialize() { Overlay = true; } protected override void OnBarUpdate() { if(CurrentBar < Count - 2) {return;} x[0] = 10; x[1] = 20; y[0] = 2; y[1] = 9; tesy = GetDLL.TestFunk(ref x, ref y); Print("X0: " + testy[0].x.ToString() + " Y0: " + testy[0].y.ToString()); Print("X1: " + testy[1].x.ToString() + " Y1: " + testy[1].y.ToString()); } class GetDLL { GetDLL() {} ~GetDLL() {} [DllImport("testdll.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "TestFunk")] public static extern TestStruct TestFunk( [In,MarshalAs(UnmanagedType.LPArray)] ref int[] x, [In,MarshalAs(UnmanagedType.LPArray)] ref int[] y ); } #region Properties #endregion } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; namespace DLLTest { [StructLayout(LayoutKind.Sequential)] public struct TestStruct { public int x, y; } class GetDLL { GetDLL() { } ~GetDLL() { } [DllImport("DLL.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "TestFunk")] public static extern TestStruct TestFunk( ref TestStruct x, ref TestStruct y ); } class Program { static TestStruct[] testy = new TestStruct[2]; static void Main(string[] args) { testy[0].x = 10; testy[0].y = 2; testy[1].x = 20; testy[1].y = 9; GetDLL.TestFunk( ref testy[0], ref testy[1] ); Console.WriteLine( "X0: " + testy[0].x.ToString() + " Y0: " + testy[0].y.ToString()); Console.WriteLine( "X1: " + testy[1].x.ToString() + " Y1: " + testy[1].y.ToString()); } } }
#define WIN32_LEAN_AND_MEAN #include <windows.h> #include <stdlib.h> #include <stdio.h> BOOL APIENTRY DllMain( HMODULE, DWORD, LPVOID ) { return TRUE; } struct TestStruct { int x, y; }; extern "C" __declspec(dllexport) void __stdcall TestFunk( void *x, void *y ) { TestStruct* ptX = (TestStruct*)x; TestStruct* ptY = (TestStruct*)y; ptX->x += 1; ptX->y += 1; ptY->x += 1; ptY->y += 1; }
... class GetDLL { GetDLL() { } ~GetDLL() { } [DllImport("DLL.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "TestFunk")] public static extern void TestFunk( ref TestStruct x, ref TestStruct y ); } ...